Merge pull request #530 from ae-utbm/redirection_for_barmen

redirect the user directly on counter when barman
This commit is contained in:
thomas girod
2023-01-11 23:24:45 +01:00
committed by GitHub
3 changed files with 64 additions and 14 deletions

View File

@ -148,6 +148,20 @@ class CounterTest(TestCase):
)
self.assertTrue(response.status_code == 200)
def test_annotate_has_barman_queryset(self):
"""
Test if the custom queryset method ``annotate_has_barman``
works as intended
"""
self.sli.counters.clear()
self.sli.counters.add(self.foyer, self.mde)
counters = Counter.objects.annotate_has_barman(self.sli)
for counter in counters:
if counter.name in ("Foyer", "MDE"):
self.assertTrue(counter.has_annotated_barman)
else:
self.assertFalse(counter.has_annotated_barman)
class CounterStatsTest(TestCase):
def setUp(self):