'Test that realm entity gets set in super-entity'

def testUpdateSharedFields(self):

    s3db = current.s3db
    auth = current.auth
    settings = current.deployment_settings
    ftable = s3db.org_office
    stable = s3db.org_site
    assertEqual = self.assertEqual
    row = ftable[self.office_id]
    row.update_record(realm_entity=row['pe_id'])
    site_id = row['site_id']
    auth.update_shared_fields(ftable, self.office_id, realm_entity=None)
    site = stable[site_id]
    assertEqual(site['realm_entity'], None)
    auth.update_shared_fields(ftable, self.office_id, realm_entity=row['realm_entity'])
    site = stable[site_id]
    assertEqual(site['realm_entity'], row['realm_entity'])
