Skip to content

Commit

Permalink
Add test method for configuration_switch
Browse files Browse the repository at this point in the history
  • Loading branch information
tomatoprinx committed Sep 16, 2024
1 parent 8b9d274 commit 1edd88c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
31 changes: 31 additions & 0 deletions src/proposals/tests/test_templatetags.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,34 @@ def test_speaker_names_display(talk_proposals, parser):
</ul>
""")
assert actual == expected

@pytest.fixture
def review_stage_keys():
review_stage_keys = [
'.proposals.creatable', '.proposals.editable', '.proposals.withdrawable',
'.reviews.visible.to.submitters', '.reviews.stage',
'.proposals.disable.after'
]
return review_stage_keys

def test_configuration_switch(review_stage_keys, parser):
result = render_template(
'{% load proposals %}'
'<ul>'
'{% for review_stage_key in proposals %}'
'<li>{{ review_stage_key|configuration_switch }}</li>'
'{% endfor %}'
'</ul>', {'proposals': review_stage_keys},
)
actual = parser.arrange(parser.parse(text=result, create_parent=False))
expected = parser.arrange("""
<ul>
<li>pycontw-2021.proposals.creatable</li>
<li>pycontw-2021.proposals.editable</li>
<li>pycontw-2021.proposals.withdrawable</li>
<li>pycontw-2021.reviews.visible.to.submitters</li>
<li>pycontw-2021.reviews.stage</li>
<li>pycontw-2021.proposals.disable.after</li>
</ul>
""")
assert actual == expected
2 changes: 1 addition & 1 deletion src/templates/default/reviews/review_stages.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ <h3 class="dashboard-header">
<div class="panel-heading">{% trans 'Current Review Stage Setting' %}</div>
<ul class="list-group">
<li class="panel-body list-group-item">
{{ ".proposals.proposals.disable.after"|configuration_switch }}
{{ ".proposals.disable.after"|configuration_switch }}
<div class="pull-right">
<p>{{ current_review_stages_setting.proposals_disable_after }}</p>
</div>
Expand Down

0 comments on commit 1edd88c

Please sign in to comment.