'Left Join for a link-table component'

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

    assertEqual = self.assertEqual
    assertTrue = self.assertTrue
    resource = current.s3db.resource('project_project')
    component = resource.components['task']
    rtable = resource.table
    ltable = component.link.table
    ctable = component.table
    expected_l = ltable.on(((ltable.project_id == rtable.id) & (ltable.deleted != True)))
    expected_r = ctable.on((ltable.task_id == ctable.id))
    ljoin = component.get_left_join()
    assertTrue(isinstance(ljoin, list))
    assertEqual(len(ljoin), 2)
    assertEqual(str(ljoin[0]), str(expected_l))
    assertEqual(str(ljoin[1]), str(expected_r))
