diff --git a/remo/voting/tests/test_views.py b/remo/voting/tests/test_views.py index cf93972d5..cf67262e2 100644 --- a/remo/voting/tests/test_views.py +++ b/remo/voting/tests/test_views.py @@ -162,6 +162,7 @@ def test_view_current_voting(self, faked_message): @mock.patch('remo.voting.views.messages') def test_view_cast_a_vote(self, fake_messages): """Cast a vote on a voting.""" + UserFactory.create(username='remobot') poll_start = now() - timedelta(days=5) poll = PollFactory.create(valid_groups=self.rep_group, start=poll_start, end=poll_start + timedelta(days=10), diff --git a/remo/voting/views.py b/remo/voting/views.py index 50870cc69..4adc3c436 100644 --- a/remo/voting/views.py +++ b/remo/voting/views.py @@ -226,6 +226,11 @@ def view_voting(request, slug): radio_poll_form.save() Vote.objects.create(user=user, poll=poll) + # Append a comment that the user voted successfully. + comment_msg = u'**{0}** voted successfully.'.format(user) + commenter = User.objects.get(username='remobot') + PollComment.objects.create(poll=poll, user=commenter, comment=comment_msg) + messages.success(request, u'Your vote has been successfully registered.') statsd.incr('voting.vote_voting') return redirect('voting_list_votings')