Skip to content
Draft
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
1 change: 1 addition & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[pytest]
norecursedirs = wcivf/static_root .tox
DJANGO_SETTINGS_MODULE = wcivf.settings
FAIL_INVALID_TEMPLATE_VARS = 1

pep8ignore =
wcivf/static_root *
Expand Down
10 changes: 10 additions & 0 deletions wcivf/apps/core/tests/test_frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from django.test import TestCase
from django.test.utils import override_settings
from django.urls import reverse
from django.core import management

import vcr

Expand All @@ -28,3 +29,12 @@ def test_200_on_important_urls(self):
for name, url in self.important_urls.items():
req = self.client.get(url)
assert req.status_code == 200


class TestTemplates:
def test_validate_templates(self):
"""
Calls management command to check templates - no need for an assert as
if something is wrong it throws an error, if not nothing happens
"""
management.call_command("validate_templates")
Original file line number Diff line number Diff line change
Expand Up @@ -166,5 +166,5 @@ <h3>Wikipedia</h3>
<p><a href="{{ postelection.wikipedia_url }}">Read more on Wikipedia</a></p>
</div>
{% endif %}
{% include "elections/includes/_ld_election.html" with election=object %}
{% include "elections/includes/_ld_election.html" with election=postelection %}
</section>
4 changes: 1 addition & 3 deletions wcivf/apps/parties/templates/parties/party_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ <h4>{{ election.grouper }}</h4>
{% for post in election.list %}
<dl>
<dt>
<a href="{{ post.get_absolute_url }}">
{{ post.post__label }}
</a>
{{ post.post__label }}
{% if post.post_election__cancelled %}
(The poll for this election was cancelled)
{% endif %}
Expand Down
6 changes: 3 additions & 3 deletions wcivf/apps/people/templates/people/person_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ <h3>That's all we know! Will you help us find more about this candidate?</h3>
<li class="disabled"><span class="show-for-sr">Current: </span> {{ object.name }}</li>
</ol>
{% endif %}

{% include "elections/includes/_ld_candidate.html" with person=object.personpost.person party=object.personpost.party %}

{% if object.personpost %}
{% include "elections/includes/_ld_candidate.html" with person=object.personpost.person party=object.personpost.party %}
{% endif %}
{% endblock breadcrumbs %}
3 changes: 2 additions & 1 deletion wcivf/apps/people/tests/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
PostFactory,
PostElectionFactory,
)
from parties.tests.factories import PartyFactory


class PersonFactory(factory.django.DjangoModelFactory):
Expand All @@ -24,5 +25,5 @@ class Meta:
person = factory.SubFactory(PersonFactory)
post = factory.SubFactory(PostFactory)
post_election = factory.SubFactory(PostElectionFactory)
party = None
party = factory.SubFactory(PartyFactory)
list_position = None