'Test mapping of multiple source docs on a single target doc'

def test_map_docs(self):

    make_test_records(u'Item')
    items = frappe.get_all(u'Item', fields=[u'name', u'item_code'], filters={u'is_sales_item': 1, u'has_variants': 0})
    customers = frappe.get_all(u'Customer')
    if (items and customers):
        customer = random.choice(customers).name
        (qtn1, item_list_1) = self.make_quotation(items, customer)
        (qtn2, item_list_2) = self.make_quotation(items, customer)
        (so, item_list_3) = self.make_sales_order()
    method = u'erpnext.selling.doctype.quotation.quotation.make_sales_order'
    updated_so = mapper.map_docs(method, json.dumps([qtn1.name, qtn2.name]), so)
    src_items = ((item_list_1 + item_list_2) + item_list_3)
    self.assertEqual(set([d.item_code for d in src_items]), set([d.item_code for d in updated_so.items]))
