redirect directly on counter if user is barman

This commit is contained in:
Thomas Girod
2022-12-17 16:31:12 +01:00
parent 26c94c9ec6
commit 31e8ad8a3e
3 changed files with 64 additions and 14 deletions

View File

@ -138,6 +138,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):