@@ 460-481 (lines=22) @@ | ||
457 | self.assertEqual(response.status_code, status.HTTP_200_OK) |
|
458 | self.assertDictEqual(StatisticsMonthsSerializer(self.data['hourly']['channel2']).data, response.data) |
|
459 | ||
460 | @freeze_time("2016-03-16") |
|
461 | @is_private() |
|
462 | def test_daily_list(self): |
|
463 | start = datetime(2016, 2, 13, 0) |
|
464 | end = start + timedelta(hours=self.n_hours-1) |
|
465 | response = self.client.get(reverse('api-statistics-live', args=('app',)), |
|
466 | dict(start=start.isoformat(), end=end.isoformat()), |
|
467 | format='json') |
|
468 | self.assertEqual(response.status_code, status.HTTP_200_OK) |
|
469 | self.assertDictEqual(StatisticsMonthsSerializer(self.data['daily']['all']).data, response.data) |
|
470 | ||
471 | response = self.client.get(reverse('api-statistics-live', args=('app',)), |
|
472 | dict(start=start.isoformat(), end=end.isoformat(), channel=self.channel.name), |
|
473 | format='json') |
|
474 | self.assertEqual(response.status_code, status.HTTP_200_OK) |
|
475 | self.assertDictEqual(StatisticsMonthsSerializer(self.data['daily']['channel1']).data, response.data) |
|
476 | ||
477 | response = self.client.get(reverse('api-statistics-live', args=('app',)), |
|
478 | dict(start=start.isoformat(), end=end.isoformat(), channel=self.channel2.name), |
|
479 | format='json') |
|
480 | self.assertEqual(response.status_code, status.HTTP_200_OK) |
|
481 | self.assertDictEqual(StatisticsMonthsSerializer(self.data['daily']['channel2']).data, response.data) |
|
482 | ||
483 | class StatisticsMonthsMixin(object): |
|
484 | url = None |
|
@@ 437-458 (lines=22) @@ | ||
434 | response = client.get(reverse('api-statistics-live', args=('app',)), format='json') |
|
435 | self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) |
|
436 | ||
437 | @freeze_time("2016-02-16") |
|
438 | @is_private() |
|
439 | def test_hourly_list(self): |
|
440 | start = datetime(2016, 2, 13, 0) |
|
441 | end = start + timedelta(hours=self.n_hours-1) |
|
442 | response = self.client.get(reverse('api-statistics-live', args=('app',)), |
|
443 | dict(start=start.isoformat(), end=end.isoformat()), |
|
444 | format='json') |
|
445 | self.assertEqual(response.status_code, status.HTTP_200_OK) |
|
446 | self.assertDictEqual(StatisticsMonthsSerializer(self.data['hourly']['all']).data, response.data) |
|
447 | ||
448 | response = self.client.get(reverse('api-statistics-live', args=('app',)), |
|
449 | dict(start=start.isoformat(), end=end.isoformat(), channel=self.channel.name), |
|
450 | format='json') |
|
451 | self.assertEqual(response.status_code, status.HTTP_200_OK) |
|
452 | self.assertDictEqual(StatisticsMonthsSerializer(self.data['hourly']['channel1']).data, response.data) |
|
453 | ||
454 | response = self.client.get(reverse('api-statistics-live', args=('app',)), |
|
455 | dict(start=start.isoformat(), end=end.isoformat(), channel=self.channel2.name), |
|
456 | format='json') |
|
457 | self.assertEqual(response.status_code, status.HTTP_200_OK) |
|
458 | self.assertDictEqual(StatisticsMonthsSerializer(self.data['hourly']['channel2']).data, response.data) |
|
459 | ||
460 | @freeze_time("2016-03-16") |
|
461 | @is_private() |