예제 #1
0
    def sets_up_deferred_saving_if_commit_is_False (self):
        voice = Voice(self.me)
        voice.revise(self.opinion, statement='blah1', position='support', commit=False)

        num_revisions = len(self.opinion.revisions.all())
        assert_equal(num_revisions, 1)
        assert hasattr(voice, 'save_revision')
예제 #2
0
    def should_create_an_opinion_with_the_given_target (self):
        voice = Voice(self.me)
        voice.express_opinion_about(self.legfile, statement='blah1', position='support')

        opinion = Opinion.objects.all()[0]
        assert_equal(opinion.opiner, self.me)
        assert_equal(opinion.target, self.legfile)
        assert_equal(opinion.latest.statement, 'blah1')
        assert_equal(opinion.latest.position, 'support')
예제 #3
0
    def should_add_a_revision_with_the_given_properties (self):
        voice = Voice(self.me)
        voice.revise(self.opinion, statement='blah2')

        revision = StatementRevision.objects.order_by('-datetime')[0]
        assert_equal(revision.statement, 'blah2')
        assert_equal(revision.position, 'oppose')

        voice.revise(self.opinion, position='support')

        revision = StatementRevision.objects.order_by('-datetime')[0]
        assert_equal(revision.statement, 'blah2')
        assert_equal(revision.position, 'support')

        voice.revise(self.opinion, statement='blah3', position='abstain')

        revision = StatementRevision.objects.order_by('-datetime')[0]
        assert_equal(revision.statement, 'blah3')
        assert_equal(revision.position, 'abstain')
예제 #4
0
    def sets_up_deferred_saving_if_commit_is_False (self):
        voice = Voice(self.me)
        opinion = voice.express_opinion_about(self.legfile, statement='blah1', position='support', commit=False)

        assert_is_none(opinion.pk)
        assert hasattr(voice, 'save_revision')