'Test merge of multiple-component'

def testMergeMultiComponent(self):

    assertEqual = self.assertEqual
    assertNotEqual = self.assertNotEqual
    assertTrue = self.assertTrue
    assertFalse = self.assertFalse
    db = current.db
    s3db = current.s3db
    deployment_settings = current.deployment_settings
    (person1, person2) = self.get_records()
    itable = s3db.pr_identity
    id1 = Storage(person_id=person1.id, type=1, value='TEST1')
    id1_id = itable.insert(**id1)
    id1.update(id=id1_id)
    s3db.update_super(itable, id1)
    id2 = Storage(person_id=person2.id, type=1, value='TEST2')
    id2_id = itable.insert(**id2)
    id2.update(id=id2_id)
    s3db.update_super(itable, id2)
    success = self.resource.merge(self.id1, self.id2)
    assertTrue(success)
    id1 = db((itable._id == id1_id)).select(limitby=(0, 1)).first()
    assertNotEqual(id1, None)
    assertFalse(id1.deleted)
    assertEqual(id1.person_id, self.id1)
    id2 = db((itable._id == id2_id)).select(limitby=(0, 1)).first()
    assertNotEqual(id2, None)
    assertFalse(id2.deleted)
    assertEqual(id2.person_id, self.id1)
