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)
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)
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)
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)
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)
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)