Renamed the AUTH48 state_alert_badge() filter to auth48_alert_badge(), as the filter is specific, not generic.

- Legacy-Id: 18439
This commit is contained in:
Henrik Levkowetz 2020-08-28 13:29:15 +00:00
parent 5a64d6027c
commit b3128842c9
4 changed files with 10 additions and 10 deletions

View file

@ -220,7 +220,7 @@ def state_age_colored(doc):
return ""
@register.filter
def state_alert_badge(doc):
def auth48_alert_badge(doc):
"""Return alert badge, if any, for a document"""
if doc.type_id != 'draft':
return ''

View file

@ -1,20 +1,20 @@
from ietf.doc.factories import WgDraftFactory
from ietf.doc.templatetags.ballot_icon import state_alert_badge
from ietf.doc.templatetags.ballot_icon import auth48_alert_badge
from ietf.utils.test_utils import TestCase
class BallotIconTests(TestCase):
def test_state_alert_badge_marks_auth48(self):
def test_auth48_alert_badge_marks_auth48(self):
draft = WgDraftFactory(states=[
('draft','active'),
('draft-iesg','rfcqueue'),
('draft-rfceditor', 'auth48'),
])
output = state_alert_badge(draft)
output = auth48_alert_badge(draft)
self.assertIn('AUTH48', output)
def test_state_alert_badge_ignores_others(self):
# If the state_alert_badge() method becomes more complicated, more
def test_auth48_alert_badge_ignores_others(self):
# If the auth48_alert_badge() method becomes more complicated, more
# sophisticated testing can be added.
# For now, just test a couple states that should not be marked.
draft = WgDraftFactory(states=[
@ -22,7 +22,7 @@ class BallotIconTests(TestCase):
('draft-iesg', 'approved'), # not in rfcqueue state
('draft-rfceditor', 'auth48'),
])
output = state_alert_badge(draft)
output = auth48_alert_badge(draft)
self.assertEqual('', output)
draft = WgDraftFactory(states=[
@ -30,5 +30,5 @@ class BallotIconTests(TestCase):
('draft-iesg', 'rfcqueue'),
('draft-rfceditor', 'auth48-done'), # not in auth48 state
])
output = state_alert_badge(draft)
output = auth48_alert_badge(draft)
self.assertEqual('', output)

View file

@ -261,7 +261,7 @@ class SearchTests(TestCase):
kwargs=dict(name=ad.full_name_as_key())))
self.assertEqual(r.status_code, 200)
self.assertContains(r, draft.name)
self.assertContains(r, 'title="AUTH48"') # title attribute of AUTH48 badge in state_alert_badge filter
self.assertContains(r, 'title="AUTH48"') # title attribute of AUTH48 badge in auth48_alert_badge filter
def test_drafts_in_last_call(self):
draft = IndividualDraftFactory(pages=1)

View file

@ -17,7 +17,7 @@
<wbr>: <a href="https://www.rfc-editor.org/queue2.html#{{ doc.name }}">{{ doc|state:"draft-rfceditor" }}</a>
{% endif %}
<wbr>{{ doc|state_alert_badge }}
<wbr>{{ doc|auth48_alert_badge }}
<wbr>{{ doc|state_age_colored }}