Ejemplo n.º 1
0
    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()
Ejemplo n.º 2
0
    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()
Ejemplo n.º 3
0
    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()
Ejemplo n.º 4
0
    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()