def build_get_meta_side_effects(metas):
	"""Returns a mock side effects method to be used as a side effect for the purpose of unit testing.
	This method replaces doctype metas for user defined ones. The returned method should be passed 
	to a unittest.mock.MagicMock instance via patch or mock. This prevents database calls and enforces
	unit test isolation.
	
	Params:
		metas: list -> A list of Meta instances created with mock_meta()

	Example:
		@patch('frappe.get_doc')
		@patch('frappe.get_meta')
		def test_fetch_quotation(self, get_meta, get_doc):
			# Mock Quotation
			get_doc.side_effect = [Document({
				"doctype": "Quotation",
				"name": "test-quotation", 
				"customer_name": "test-customer"
			})]

			# Mock Quotation Metadata. Notice the limited set of fields.
			get_meta.side_effect = build_get_meta_side_effects(
				mock_meta("Quotation", fields=[
					{ "fieldname": "name", "fieldtype": "Data" },
					{ "fieldname": "customer_name", "fieldtype": "Link", "options": "Customer" }
				])
			)

			# Fetches the mocked quotation
			doc = frappe.get_doc("Quotation", "test-quotation")

			# Then perform your tests
			get_doc.assert_called()
			get_meta.assert_called()
			self.assertTrue(doc.customer == "test-customer")
	"""

	def side_effect(doctype, cached=False):
		for meta in metas:
			if meta.name == doctype:
				return meta

		raise Exception("Unexpected get_meta doctype: {}".format(doctype))
	
	return side_effect