Skip to content

Commit

Permalink
Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Felix Sargent committed Feb 3, 2024
1 parent 672effa commit 9b4ebfe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
9 changes: 1 addition & 8 deletions approval_polls/staticfiles/detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@ $(function () {
$("#share").jsSocials({
showLabel: false,
showCount: false,
shares: [
"email",
"twitter",
"facebook",
"googleplus",
"linkedin",
"pinterest",
],
shares: ["email", "twitter", "facebook", "linkedin", "pinterest"],
});

var invitation_key, invitation_email;
Expand Down
8 changes: 4 additions & 4 deletions approval_polls/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,13 @@ def test_detail_view_with_a_choice(self):
class PollResultsTests(TestCase):
def test_results_view_with_no_ballots(self):
"""
Results page of a poll with a choice shows 0 votes (0%),
Results page of a poll with a choice shows 0 votes (0.00%),
0 votes on 0 ballots.
"""
poll = create_poll(question="Choice poll.")
poll.choice_set.create(choice_text="Choice text.")
response = self.client.get(reverse("results", args=(poll.id,)))
self.assertContains(response, "0 votes (0%)", status_code=200)
self.assertContains(response, "0 votes (0.00%)", status_code=200)
self.assertContains(response, "0 votes on 0", status_code=200)

def test_results_view_with_ballots(self):
Expand All @@ -197,7 +197,7 @@ def test_results_view_with_ballots(self):
choice = poll.choice_set.create(choice_text="Choice text.")
create_ballot(poll).vote_set.create(choice=choice)
response = self.client.get(reverse("results", args=(poll.id,)))
self.assertContains(response, "1 vote (50%)", status_code=200)
self.assertContains(response, "1 vote (50.00%)", status_code=200)
self.assertContains(response, "1 vote on 2", status_code=200)


Expand All @@ -215,7 +215,7 @@ def test_vote_view_counts_increase(self):
choice2 = poll.choice_set.create(choice_text="Choice 2.")
for _ in range(10):
create_ballot(poll).vote_set.create(choice=choice1)
for _ in range(10):
for _ in range(21):
create_ballot(poll).vote_set.create(choice=choice2)
response = self.client.post(
"/" + str(poll.id) + "/vote/",
Expand Down

0 comments on commit 9b4ebfe

Please sign in to comment.