Skip to content
Snippets Groups Projects
Commit 949592df authored by Calum Mackervoy's avatar Calum Mackervoy Committed by Benoit Alessandroni
Browse files

update: no cache on TotalVotes serializer

parent c937fe56
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,7 @@ from djangoldp_polls.models import PollOption
class PollOptionSerializer(LDPSerializer):
total_votes = serializers.SerializerMethodField()
with_cache = False
class Meta:
model = PollOption
......
......@@ -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()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment