Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 43 additions & 1 deletion ietf/doc/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
ConflictReviewFactory, WgDraftFactory, IndividualDraftFactory, WgRfcFactory,
IndividualRfcFactory, StateDocEventFactory, BallotPositionDocEventFactory,
BallotDocEventFactory, DocumentAuthorFactory, NewRevisionDocEventFactory,
StatusChangeFactory, BofreqFactory, DocExtResourceFactory)
StatusChangeFactory, BofreqFactory, DocExtResourceFactory, RgDraftFactory)
from ietf.doc.forms import NotifyForm
from ietf.doc.fields import SearchableDocumentsField
from ietf.doc.utils import create_ballot_if_not_open, uppercase_std_abbreviated_name
Expand Down Expand Up @@ -2819,3 +2819,45 @@ def test_notify_validation(self):
self.assertFalse(f.is_valid())
self.assertTrue("Invalid addresses" in f.errors["notify"][0])
self.assertTrue("Duplicate addresses" in f.errors["notify"][0])

class CanRequestConflictReviewTests(TestCase):
def test_gets_request_conflict_review_action_button(self):
ise_draft = IndividualDraftFactory(stream_id="ise")
irtf_draft = RgDraftFactory()

# This is blunt, trading off precision for time. A more thorough test would ensure
# that the text is in a button and that the correct link is absent/present as well.

target_string = "Begin IETF conflict review"

url = urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=irtf_draft.name))
r = self.client.get(url)
self.assertNotContains(r, target_string)
self.client.login(username="secretary", password="secretary+password")
r = self.client.get(url)
self.assertContains(r, target_string)
self.client.logout()
self.client.login(username="irtf-chair", password="irtf-chair+password")
r = self.client.get(url)
self.assertContains(r, target_string)
self.client.logout()
self.client.login(username="ise-chair", password="ise-chair+password")
r = self.client.get(url)
self.assertNotContains(r, target_string)
self.client.logout()

url = urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=ise_draft.name))
r = self.client.get(url)
self.assertNotContains(r, target_string)
self.client.login(username="secretary", password="secretary+password")
r = self.client.get(url)
self.assertContains(r, target_string)
self.client.logout()
self.client.login(username="irtf-chair", password="irtf-chair+password")
r = self.client.get(url)
self.assertNotContains(r, target_string)
self.client.logout()
self.client.login(username="ise-chair", password="ise-chair+password")
r = self.client.get(url)
self.assertContains(r, target_string)

20 changes: 14 additions & 6 deletions ietf/doc/views_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,12 +427,20 @@ def document_main(request, name, rev=None, document_html=False):
urlreverse('ietf.doc.views_ballot.close_rsab_ballot', kwargs=dict(name=doc.name))
))

if (doc.get_state_slug() not in ["rfc", "expired"] and doc.stream_id in ("ise", "irtf")
and has_role(request.user, ("Secretariat", "IRTF Chair")) and not conflict_reviews and not snapshot):
label = "Begin IETF Conflict Review"
if not doc.intended_std_level:
label += " (note that intended status is not set)"
actions.append((label, urlreverse('ietf.doc.views_conflict_review.start_review', kwargs=dict(name=doc.name))))
if (
doc.get_state_slug() not in ["rfc", "expired"]
and not conflict_reviews
and not snapshot
):
if (
doc.stream_id == "ise" and has_role(request.user, ("Secretariat", "ISE"))
) or (
doc.stream_id == "irtf" and has_role(request.user, ("Secretariat", "IRTF Chair"))
):
label = "Begin IETF conflict review" # Note that the template feeds this through capfirst_allcaps
if not doc.intended_std_level:
label += " (note that intended status is not set)"
actions.append((label, urlreverse('ietf.doc.views_conflict_review.start_review', kwargs=dict(name=doc.name))))

if doc.get_state_slug() not in ["rfc", "expired"] and not snapshot:
if can_request_rfc_publication(request.user, doc):
Expand Down