test_statistics.py 640 B

1234567891011121314151617181920
  1. from django.utils import timezone
  2. from model_bakery import baker
  3. from glitchtip.test_utils.test_case import GlitchTipTestCase
  4. from ..models import EventProjectHourlyStatistic
  5. class ProjectStatisticsTestCase(GlitchTipTestCase):
  6. def setUp(self):
  7. self.project = baker.make("projects.Project")
  8. def test_update_count(self):
  9. baker.make("events.Event", issue__project=self.project)
  10. EventProjectHourlyStatistic.update(self.project.pk, timezone.now())
  11. self.assertTrue(
  12. EventProjectHourlyStatistic.objects.filter(
  13. project=self.project, count=1
  14. ).exists()
  15. )