Beispiel #1
0
  def testTasksWithFilters(self):
    """Tests with applying a filters on properties."""
    # seed another organization
    other_org = seeder_logic.seed(org_model.GCIOrganization)

    # seed another task for that organization and the seeded mentor
    task_properties = {
        'mentors': [self.profile.key()],
        'status': task_model.CLAIMED,
        'org': other_org,
        'student': None,
        }
    other_task = seeder_logic.seed(
        task_model.GCITask, properties=task_properties)

    # check querying tasks for organization filter
    extra_filters = {task_model.GCITask.org: [self.org]}
    query = task_logic.queryTasksForMentor(
        self.profile.key(), extra_filters=extra_filters)
    self.assertSetEqual(
        set(entity.key() for entity in query),
        set([self.task1.key(), self.task2.key()]))

    # check querying tasks for status filter
    extra_filters = {
        task_model.GCITask.status: [task_model.CLAIMED, task_model.OPEN]
        }
    query = task_logic.queryTasksForMentor(
        self.profile.key(), extra_filters=extra_filters)
    self.assertSetEqual(
        set(entity.key() for entity in query),
        set([self.task1.key(), self.task2.key(), other_task.key()]))
Beispiel #2
0
    def testTasksWithFilters(self):
        """Tests with applying a filters on properties."""
        # seed another organization
        other_org = seeder_logic.seed(org_model.GCIOrganization)

        # seed another task for that organization and the seeded mentor
        task_properties = {
            "mentors": [self.profile.key()],
            "status": task_model.CLAIMED,
            "org": other_org,
            "student": None,
        }
        other_task = seeder_logic.seed(task_model.GCITask, properties=task_properties)

        # check querying tasks for organization filter
        extra_filters = {task_model.GCITask.org: [self.org]}
        query = task_logic.queryTasksForMentor(self.profile.key(), extra_filters=extra_filters)
        self.assertSetEqual(set(entity.key() for entity in query), set([self.task1.key(), self.task2.key()]))

        # check querying tasks for status filter
        extra_filters = {task_model.GCITask.status: [task_model.CLAIMED, task_model.OPEN]}
        query = task_logic.queryTasksForMentor(self.profile.key(), extra_filters=extra_filters)
        self.assertSetEqual(
            set(entity.key() for entity in query), set([self.task1.key(), self.task2.key(), other_task.key()])
        )
Beispiel #3
0
 def testAllTasksFetched(self):
   """Tests that all tasks for the mentor are fetched."""
   query = task_logic.queryTasksForMentor(self.profile.key())
   self.assertEqual(query.count(), 2)
Beispiel #4
0
 def testAllTasksFetched(self):
     """Tests that all tasks for the mentor are fetched."""
     query = task_logic.queryTasksForMentor(self.profile.key())
     self.assertEqual(query.count(), 2)