'Test import of organisation parents using alias-attribute'

def testParentImport(self):

    db = current.db
    s3db = current.s3db
    current.auth.override = True
    resource = s3db.resource('org_organisation')
    msg = resource.import_xml(self.parent_tree)
    table = resource.table
    query = (table.name == 'MasterOrg2')
    master = db(query).select(table._id, limitby=(0, 1)).first()
    self.assertNotEqual(master, None)
    query = (table.name == 'BranchOrg2')
    branch = db(query).select(table._id, limitby=(0, 1)).first()
    self.assertNotEqual(branch, None)
    table = s3db.org_organisation_branch
    query = ((table.organisation_id == master.id) & (table.branch_id == branch.id))
    link = db(query).select(limitby=(0, 1)).first()
    self.assertNotEqual(link, None)
