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

        assertEqual = self.assertEqual
        assertTrue = self.assertTrue

        s3db = current.s3db
        resource = s3db.resource("hrm_human_resource")

        pr_person = s3db.pr_person
        hrm_human_resource = s3db.hrm_human_resource
        pr_contact = s3db.pr_contact

        component = resource.components["email"]
        pr_email_contact = pr_contact.with_alias("pr_email_contact")
        ljoin = component.get_left_join()

        assertTrue(isinstance(ljoin, list))
        assertEqual(len(ljoin), 2)
        assertEqual(str(ljoin[0]), str(pr_person.on(
                        (hrm_human_resource.person_id == pr_person.id) &
                        (pr_person.deleted != True))))

        assertEqual(str(ljoin[1]), str(pr_email_contact.on(
                        (pr_person.pe_id == pr_email_contact.pe_id) &
                        (pr_email_contact.contact_method == "EMAIL"))))

        component = resource.components["phone"]
        pr_phone_contact = pr_contact.with_alias("pr_phone_contact")
        ljoin = component.get_left_join()

        assertTrue(isinstance(ljoin, list))
        assertEqual(len(ljoin), 2)
        assertEqual(str(ljoin[0]), str(pr_person.on(
                        (hrm_human_resource.person_id == pr_person.id) &
                        (pr_person.deleted != True))))

        assertEqual(str(ljoin[1]), str(pr_phone_contact.on(
                        (pr_person.pe_id == pr_phone_contact.pe_id) &
                        (pr_phone_contact.contact_method == "SMS"))))

    # -------------------------------------------------------------------------
    # Disabled - @todo: must create test records (otherwise component can be
    # empty regardless) - and check the actual office_type_ids (can not assume 4/5)
Left Join for a link-table component with alias
dataset/ETHPy150Open sahana/eden/modules/unit_tests/s3/s3resource.py/ResourceFilteredComponentTests.testGetLeftJoinLinkTableComponentAlias