'Test simple component filter construction (check query in filter)'

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

    s3db = current.s3db
    assertEqual = self.assertEqual
    assertTrue = self.assertTrue
    project_project = s3db.project_project
    project_activity = s3db.project_activity
    resource = s3db.resource('project_project', id=1)
    component = resource.components['activity']
    component.build_query()
    rfilter = component.rfilter
    query = rfilter.get_query()
    expected = (((project_activity.deleted != True) & (project_activity.id > 0)) & (((project_project.deleted != True) & (project_project.id > 0)) & (project_project.id == 1)))
    assertEqual(str(query), str(expected))
    join = rfilter.get_joins(left=False, as_list=False)
    expected = project_project.on((project_activity.project_id == project_project.id))
    tablenames = join.keys()
    assertEqual(len(tablenames), 1)
    assertTrue(('project_project' in tablenames))
    assertTrue(isinstance(join['project_project'], list))
    assertEqual(len(join['project_project']), 1)
    assertEqual(str(join['project_project'][0]), str(expected))
    left = rfilter.get_joins(left=True, as_list=False)
    assertEqual(left, {})
    rows = component.select(None, limit=1, as_rows=True)
