Skip to content

Commit f6886f6

Browse files
committed
Corrected a conditional expression and improved the test that exercised it. Commit ready for merge.
- Legacy-Id: 15822
1 parent 6118975 commit f6886f6

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

ietf/doc/tests_draft.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import datetime
55
import StringIO
66
from pyquery import PyQuery
7+
from collections import Counter
78

89
from django.urls import reverse as urlreverse
910
from django.conf import settings
@@ -1110,7 +1111,7 @@ def test_cancel_submission(self):
11101111
url = urlreverse('ietf.doc.views_draft.to_iesg', kwargs=dict(name=self.docname))
11111112
self.client.login(username="marschairman", password="marschairman+password")
11121113

1113-
r = self.client.post(url, dict(cancel="1"))
1114+
r = self.client.post(url, dict(cancel="1"))
11141115
self.assertEqual(r.status_code, 302)
11151116

11161117
doc = Document.objects.get(name=self.docname)
@@ -1121,10 +1122,10 @@ def test_confirm_submission(self):
11211122
self.client.login(username="marschairman", password="marschairman+password")
11221123

11231124
doc = Document.objects.get(name=self.docname)
1124-
docevent_count_pre = doc.docevent_set.count()
1125+
docevents_pre = set(doc.docevent_set.all())
11251126
mailbox_before = len(outbox)
11261127

1127-
r = self.client.post(url, dict(confirm="1"))
1128+
r = self.client.post(url, dict(confirm="1"))
11281129
self.assertEqual(r.status_code, 302)
11291130

11301131
doc = Document.objects.get(name=self.docname)
@@ -1136,7 +1137,12 @@ def test_confirm_submission(self):
11361137
# checks whether the setup document had an ad or not.
11371138
self.assertTrue(doc.ad!=None)
11381139

1139-
self.assertTrue(doc.docevent_set.count() != docevent_count_pre)
1140+
new_docevents = set(doc.docevent_set.all()) - docevents_pre
1141+
self.assertEqual(len(new_docevents),3)
1142+
new_docevent_type_count = Counter([e.type for e in new_docevents])
1143+
self.assertEqual(new_docevent_type_count['changed_state'],2)
1144+
self.assertEqual(new_docevent_type_count['started_iesg_process'],1)
1145+
11401146
self.assertEqual(len(outbox), mailbox_before + 1)
11411147
self.assertTrue("Publication has been requested" in outbox[-1]['Subject'])
11421148
self.assertTrue("aread@" in outbox[-1]['To'])

ietf/doc/views_draft.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ def to_iesg(request,name):
550550

551551
changes = []
552552

553-
if not doc.get_state("draft-iesg"):
553+
if doc.get_state_slug("draft-iesg") == "idexists":
554554
e = DocEvent()
555555
e.type = "started_iesg_process"
556556
e.by = by

0 commit comments

Comments
 (0)