From c6da5673a77c98bfb741bbc0538c41ed1acaed55 Mon Sep 17 00:00:00 2001 From: Calum Mackervoy <c.mackervoy@gmail.com> Date: Fri, 16 Oct 2020 19:00:37 +0200 Subject: [PATCH] update: added unit test --- djangoldp_polls/tests/tests_votes.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/djangoldp_polls/tests/tests_votes.py b/djangoldp_polls/tests/tests_votes.py index 5827435..c95ccc0 100644 --- a/djangoldp_polls/tests/tests_votes.py +++ b/djangoldp_polls/tests/tests_votes.py @@ -37,6 +37,16 @@ class PermissionsTestCase(APITestCase): 'chosenOption': {'@id': option.urlid} } + def test_get_total_votes_cache(self): + self.setUpPoll() + response = self.client.get('/polloptions/{}/'.format(self.poll_option_a.pk)) + self.assertFalse('total_votes' in response.data) + + response = self.client.get('/polls/total_votes/{}/'.format(self.poll.pk)) + print(str(response.data)) + self.assertTrue('total_votes' in response.data['ldp:contains'][0]) + self.assertTrue('total_votes' in response.data['ldp:contains'][1]) + def test_can_vote_view(self): # I should be able to vote self.setUpPoll() -- GitLab