'Join for a link-table component with alias'

@unittest.skipIf((not current.deployment_settings.has_module('hrm')), 'hrm    module    disabled')
def testGetJoinLinkTableComponentAlias(self):

    assertEqual = self.assertEqual
    s3db = current.s3db
    hrm_human_resource = s3db.hrm_human_resource
    pr_person = s3db.pr_person
    pr_email_contact = s3db.pr_contact.with_alias('pr_email_contact')
    pr_phone_contact = s3db.pr_contact.with_alias('pr_phone_contact')
    resource = current.s3db.resource('hrm_human_resource')
    component = resource.components['email']
    join = component.get_join()
    expected = (((hrm_human_resource.person_id == pr_person.id) & (pr_person.deleted != True)) & ((pr_person.pe_id == pr_email_contact.pe_id) & (pr_email_contact.contact_method == 'EMAIL')))
    assertEqual(str(join), str(expected))
    component = resource.components['phone']
    join = component.get_join()
    expected = (((hrm_human_resource.person_id == pr_person.id) & (pr_person.deleted != True)) & ((pr_person.pe_id == pr_phone_contact.pe_id) & (pr_phone_contact.contact_method == 'SMS')))
    assertEqual(str(join), str(expected))
