Exemple #1
0
 def test_state_is_not_set_for_poll_box_in_first_of_double_renders(self):
     settings.DOUBLE_RENDER = True
     user = User.objects.create(username='******')
     Vote.objects.create(poll=self.poll, user=user)
     box = Poll.box_class(self.poll, 'name', NodeList())
     box.prepare(Context({'request': build_request(user=user)}))
     tools.assert_equals(None, box.state)
Exemple #2
0
 def test_state_is_set_for_poll_box(self):
     user = User.objects.create(username='******')
     Vote.objects.create(poll=self.poll, user=user)
     box = Poll.box_class(self.poll, 'name', NodeList())
     box.prepare(Context({'request': build_request(user=user)}))
     tools.assert_equals(
         conf.USER_ALLREADY_VOTED,
         box.state)
Exemple #3
0
 def test_state_is_set_for_poll_box_in_second_of_double_renders(self):
     settings.DOUBLE_RENDER = True
     user = User.objects.create(username='******')
     Vote.objects.create(poll=self.poll, user=user)
     box = Poll.box_class(self.poll, 'name', NodeList())
     box.prepare(Context({'request': build_request(user=user), 'SECOND_RENDER': True}))
     tools.assert_equals(
         conf.USER_ALLREADY_VOTED,
         box.state)
Exemple #4
0
 def test_state_is_not_set_for_poll_box_in_first_of_double_renders(self):
     settings.DOUBLE_RENDER = True
     user = User.objects.create(username='******')
     Vote.objects.create(poll=self.poll, user=user)
     box = Poll.box_class(self.poll, 'name', NodeList())
     box.prepare(Context({'request': build_request(user=user)}))
     tools.assert_equals(
         None,
         box.state)
Exemple #5
0
 def test_state_is_set_for_poll_box_in_second_of_double_renders(self):
     settings.DOUBLE_RENDER = True
     user = User.objects.create(username='******')
     Vote.objects.create(poll=self.poll, user=user)
     box = Poll.box_class(self.poll, 'name', NodeList())
     box.prepare(
         Context({
             'request': build_request(user=user),
             'SECOND_RENDER': True
         }))
     tools.assert_equals(conf.USER_ALLREADY_VOTED, box.state)
Exemple #6
0
 def test_state_is_set_for_poll_box(self):
     user = User.objects.create(username='******')
     Vote.objects.create(poll=self.poll, user=user)
     box = Poll.box_class(self.poll, 'name', NodeList())
     box.prepare(Context({'request': build_request(user=user)}))
     tools.assert_equals(conf.USER_ALLREADY_VOTED, box.state)