From 793bb146c910307cdfdce77d7c93b187c8a086fe Mon Sep 17 00:00:00 2001 From: Ole Laursen Date: Thu, 16 Feb 2012 16:42:11 +0000 Subject: [PATCH] Expand send ballot comment test to check discuss too, fix bug where it was testing pos directly instead of pos_id - Legacy-Id: 3931 --- ietf/idrfc/testsREDESIGN.py | 15 ++++++++++----- ietf/idrfc/views_ballot.py | 4 ++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/ietf/idrfc/testsREDESIGN.py b/ietf/idrfc/testsREDESIGN.py index 542f27f4c..963b05ae9 100644 --- a/ietf/idrfc/testsREDESIGN.py +++ b/ietf/idrfc/testsREDESIGN.py @@ -524,10 +524,13 @@ class EditPositionTestCase(django.test.TestCase): ad = Person.objects.get(name="Aread Irector") - BallotPositionDocEvent.objects.create(doc=draft, type="changed_ballot_position", - by=ad, ad=ad, pos=BallotPositionName.objects.get(slug="yes"), - comment="Test!", - comment_time=datetime.datetime.now()) + BallotPositionDocEvent.objects.create( + doc=draft, type="changed_ballot_position", + by=ad, ad=ad, pos=BallotPositionName.objects.get(slug="discuss"), + discuss="This draft seems to be lacking a clearer title?", + discuss_time=datetime.datetime.now(), + comment="Test!", + comment_time=datetime.datetime.now()) url = urlreverse('doc_send_ballot_comment', kwargs=dict(name=draft.name)) login_testing_unauthorized(self, "ad", url) @@ -547,9 +550,11 @@ class EditPositionTestCase(django.test.TestCase): self.assertEquals(len(outbox), mailbox_before + 1) m = outbox[-1] self.assertTrue("COMMENT" in m['Subject']) + self.assertTrue("DISCUSS" in m['Subject']) self.assertTrue(draft.name in m['Subject']) + self.assertTrue("clearer title" in str(m)) self.assertTrue("Test!" in str(m)) - + class DeferBallotTestCase(django.test.TestCase): fixtures = ['names'] diff --git a/ietf/idrfc/views_ballot.py b/ietf/idrfc/views_ballot.py index 37666cce0..6701facf2 100644 --- a/ietf/idrfc/views_ballot.py +++ b/ietf/idrfc/views_ballot.py @@ -462,10 +462,10 @@ def send_ballot_commentREDESIGN(request, name): pos = doc.latest_event(BallotPositionDocEvent, type="changed_ballot_position", ad=ad, time__gte=started_process.time) if not pos: raise Http404() - + subj = [] d = "" - if pos.pos == "discuss" and pos.discuss: + if pos.pos_id == "discuss" and pos.discuss: d = pos.discuss subj.append("DISCUSS") c = ""