Expand send ballot comment test to check discuss too, fix bug where it

was testing pos directly instead of pos_id
 - Legacy-Id: 3931
This commit is contained in:
Ole Laursen 2012-02-16 16:42:11 +00:00
parent 724067aa89
commit 793bb146c9
2 changed files with 12 additions and 7 deletions

View file

@ -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']

View file

@ -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 = ""