def test_cannot_be_associated_with_a_user_and_a_session_key_at_the_same_time_to_be_created(self): # noqa # Setup poll = TopicPollFactory.create(topic=self.topic, max_options=2) option_1 = TopicPollOptionFactory.create(poll=poll) TopicPollOptionFactory.create(poll=poll) # Run & check with pytest.raises(ValidationError): vote = TopicPollVoteFactory.build( poll_option=option_1, voter=self.u1, anonymous_key='ertyue') vote.clean()
def test_must_be_associated_with_a_user_or_a_session_key_to_be_created(self): # Setup poll = TopicPollFactory.create(topic=self.topic, max_options=2) option_1 = TopicPollOptionFactory.create(poll=poll) TopicPollOptionFactory.create(poll=poll) # Run & check with pytest.raises(ValidationError): vote = TopicPollVoteFactory.build( poll_option=option_1, voter=None, anonymous_key=None) vote.clean()