'Test merge of a simple reference including super-entity'

def testMergeSimpleReference(self):

    assertEqual = self.assertEqual
    assertNotEqual = self.assertNotEqual
    assertTrue = self.assertTrue
    db = current.db
    s3db = current.s3db
    otable = s3db.org_office
    office = Storage(name='Test    Office', location_id=self.id2)
    office_id = otable.insert(**office)
    office.update(id=office_id)
    s3db.update_super(otable, office)
    success = self.resource.merge(self.id1, self.id2)
    assertTrue(success)
    office = db((otable._id == office.id)).select(limitby=(0, 1)).first()
    assertNotEqual(office, None)
    assertEqual(office.location_id, self.id1)
    stable = s3db.org_site
    site = db((stable.site_id == office.site_id)).select(limitby=(0, 1)).first()
    assertNotEqual(site, None)
    assertEqual(site.location_id, self.id1)
