Skip to content

Commit

Permalink
Update pre-sopn ballot text with candidates
Browse files Browse the repository at this point in the history
  • Loading branch information
VirginiaDooley authored and Virginia Dooley committed Sep 25, 2023
1 parent f655392 commit 82d9834
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,22 @@ <h3>{% if postelection.is_london_assembly_additional %}{% trans "Additional memb

{% else %}
{# Case: Candidates and the post is NOT locked (add CTA) #}
{% blocktrans trimmed with num_ballots=postelection.party_ballot_count postelection=postelection.friendly_name ynr_link=postelection.ynr_link %}
The official candidate list has not yet been published.
However, we expect at least <strong>{{ num_ballots }}</strong>
in the {{ postelection }}.
{% blocktrans trimmed with expected_sopn_date=postelection.expected_sopn_date|date:"j F Y" count counter=postelection.people.count %}
This candidate will not be confirmed until the council publishes
the official candidate list on {{ expected_sopn_date }}.
{% plural %}
These candidates will not be confirmed until the council publishes
the official candidate list on {{ expected_sopn_date }}.
{% endblocktrans %}


{% blocktrans trimmed with ynr_link=postelection.ynr_link %}
Once nomination papers are published, we will manually verify each candidate.
You can help improve this page: <a href="{{ ynr_link }}">
add information about candidates to our database</a>.
{% endblocktrans %}


{% endif %}

{% endif %}
Expand Down
39 changes: 39 additions & 0 deletions wcivf/apps/elections/tests/test_election_views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import datetime
from random import shuffle

import factory
Expand Down Expand Up @@ -137,6 +138,44 @@ def setUp(self):
election=self.election, post=self.post
)

def test_pre_sopn_text_with_candidates(self):
future_election = ElectionFactory(
name="Adur local election",
election_date="2024-05-06",
slug="local.adur.churchill.2024-05-06",
)
future_post = PostFactory(label="Adur local election")
future_post_election = PostElectionFactory(
election=future_election,
post=future_post,
ballot_paper_id="local.adur.churchill.2024-05-06",
)
future_post.territory = "ENG"
future_post.save()
person = PersonFactory()
PersonPostFactory(
post_election=future_post_election,
election=future_election,
post=future_post,
person=person,
)
response = self.client.get(
future_post_election.get_absolute_url(), follow=True
)
self.assertEqual(response.status_code, 200)
self.assertFalse(future_post_election.locked)
self.assertEqual(len(future_post_election.personpost_set.all()), 1)
self.assertEqual(
future_post_election.expected_sopn_date, datetime.date(2024, 4, 10)
)

pre_sopn_text = """This candidate will not be confirmed until the council publishes the official candidate list on 10 April 2024."""
self.assertContains(response, pre_sopn_text)
self.assertContains(
response,
"""Once nomination papers are published, we will manually verify each candidate.""",
)

def test_zero_candidates(self):
response = self.client.get(
self.post_election.get_absolute_url(), follow=True
Expand Down

0 comments on commit 82d9834

Please sign in to comment.