Exemplo n.º 1
0
 def test_time_spent_queries_filter(self):
     requests = [mock_suite.mock_request() for _ in range(0, 10)]
     time_taken = sorted(sum(q.time_taken for q in x.queries.all()) for x in requests)
     c = time_taken[int(floor(len(time_taken) / 2))]
     time_taken_filter = TimeSpentOnQueriesFilter(c)
     query_set = models.Request.objects.all()
     query_set = time_taken_filter.contribute_to_query_set(query_set)
     filtered = query_set.filter(time_taken_filter)
     for f in filtered:
         self.assertGreaterEqual(sum(q.time_taken for q in f.queries.all()), c)
Exemplo n.º 2
0
 def test_time_spent_queries_filter(self):
     requests = [mock_suite.mock_request() for _ in range(0, 10)]
     time_taken = sorted(sum(q.time_taken for q in x.queries.all()) for x in requests)
     c = time_taken[int(floor(len(time_taken) / 2))]
     time_taken_filter = TimeSpentOnQueriesFilter(c)
     query_set = models.RequestSkill.objects.all()
     query_set = time_taken_filter.contribute_to_query_set(query_set)
     filtered = query_set.filter(time_taken_filter)
     for f in filtered:
         self.assertGreaterEqual(sum(q.time_taken for q in f.queries.all()), c)
Exemplo n.º 3
0
 def test_time_spent_queries_filter(self):
     profiles = mock_suite.mock_profiles(n=10)
     time_taken = sorted(sum(q.time_taken for q in x.queries.all()) for x in profiles)
     c = time_taken[int(floor(len(time_taken) / 2))]
     time_taken_filter = TimeSpentOnQueriesFilter(c)
     query_set = models.Profile.objects.all()
     query_set = time_taken_filter.contribute_to_query_set(query_set)
     filtered = query_set.filter(time_taken_filter)
     for f in filtered:
         self.assertGreaterEqual(sum(q.time_taken for q in f.queries.all()), c)
Exemplo n.º 4
0
 def test_time_spent_queries_filter(self):
     profiles = mock_suite.mock_profiles(n=10)
     time_taken = sorted(sum(q.time_taken for q in x.queries.all()) for x in profiles)
     c = time_taken[int(floor(len(time_taken) / 2))]
     time_taken_filter = TimeSpentOnQueriesFilter(c)
     query_set = models.Profile.objects.all()
     query_set = time_taken_filter.contribute_to_query_set(query_set)
     filtered = query_set.filter(time_taken_filter)
     for f in filtered:
         self.assertGreaterEqual(sum(q.time_taken for q in f.queries.all()), c)