Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
VirginiaDooley committed Feb 25, 2021
1 parent 0149d1f commit 6ec8bd9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
5 changes: 1 addition & 4 deletions wcivf/apps/people/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,8 @@ def statement_intro(self):

@property
def statement_remainder(self):
statement_intro = self.statement_intro
# statement_to_voters = self.statement_to_voters
# statement_split = statement_to_voters.split("\n")
statement_split = self.statement_to_voters.split(".")
statement_remainder = "".join(statement_split[1:])
statement_remainder = ".".join(statement_split[1:])

return statement_remainder

Expand Down
8 changes: 3 additions & 5 deletions wcivf/apps/people/tests/test_person_models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from elections.tests.factories import (
ElectionFactory,
PostFactory,
PostElectionFactory,
)
from parties.tests.factories import PartyFactory
from people.tests.factories import PersonFactory, PersonPostFactory
Expand All @@ -13,7 +11,7 @@ def setUp(self):
self.person = PersonFactory()

def test_long_statement(self):
self.person.statement_to_voters = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus est eleven."
self.person.statement_to_voters = "Lorem ipsum dolor sit amet, yo consectetur adipiscing elit. Nam eget metus dui. Integer a velit viverra, interdum dui eget, lobortis massa. Nam pharetra, risus eu gravida ullamcorper, enim nisl ornare lectus, at eleifend tellus lacus quis velit. Sed ornare volutpat aliquam. Donec fermentum dapibus odio, vel gravida augue ornare non. Donec ultrices consequat ullamcorper. Proin ac ante et tellus ultrices aliquam lobortis quis orci. Nunc eget eros facilisis, sagittis nibh quis, feugiat purus. Integer nibh erat, dapibus eget vehicula non, tincidunt at eros. Etiam varius ultricies mollis. Morbi eros diam, hendrerit eu condimentum maximus, lobortis sit amet turpis. Cras quam."
assert self.person.long_statement is True

def test_short_statement(self):
Expand All @@ -31,10 +29,10 @@ def test_statement_intro(self):
assert self.person.statement_intro == "Lorem ipsum dolor sit amet."

def test_statement_remainder(self):
self.person.statement_to_voters = "Lorem ipsum dolor sit amet.\nConsectetur adipiscing elit.\nVivamus est eleven."
self.person.statement_to_voters = "Lorem ipsum dolor sit amet. Consectetur adipiscing elit. Vivamus est eleven."
assert (
self.person.statement_remainder
== "Consectetur adipiscing elit.\nVivamus est eleven."
== " Consectetur adipiscing elit. Vivamus est eleven."
)

def test_display_deceased(self):
Expand Down
4 changes: 2 additions & 2 deletions wcivf/apps/people/tests/test_person_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ def test_not_current_person_view(self):
self.assertTemplateUsed(
response, "people/not_current_person_detail.html"
)
self.assertContains(response, "Previous Elections")
self.assertNotContains(response, "Contact information")
self.assertContains(response, f"{ self.person.name} stood for election")
self.assertNotContains(response, f"{ self.person.name} Online")
self.assertContains(response, '<meta name="robots" content="noindex">')

def test_not_current_person_with_twfy_id(self):
Expand Down

0 comments on commit 6ec8bd9

Please sign in to comment.