Skip to content
Open
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
17 changes: 10 additions & 7 deletions tests/test_nuancier.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import nuancier
import nuancier.lib as nuancierlib
from nuancier.lib import model
from nuancier_schema import ElectionEdited, CandidateApproved, CandidateCreated
from nuancier_schema import ElectionCreated, ElectionEdited, CandidateApproved, CandidateCreated, CandidateDenied
from tests import (Modeltests, create_elections, create_candidates,
create_votes, FakeFasUser, user_set, approve_candidate,
deny_candidate, CACHE_FOLDER, PICTURE_FOLDER, TODAY)
Expand Down Expand Up @@ -1254,8 +1254,9 @@ def test_admin_new(self):
'csrf_token': csrf_token,
}

output = self.app.post('/admin/new/', data=data,
follow_redirects=True)
with fml_testing.mock_sends(ElectionCreated):
output = self.app.post('/admin/new/', data=data,
follow_redirects=True)
self.assertEqual(output.status_code, 200)
# Redirected to the admin index page, after the creation
self.assertTrue(
Expand Down Expand Up @@ -1299,8 +1300,9 @@ def test_admin_new(self):
'csrf_token': csrf_token,
}

output = self.app.post('/admin/new/', data=data,
follow_redirects=True)
with fml_testing.mock_sends(ElectionCreated):
output = self.app.post('/admin/new/', data=data,
follow_redirects=True)
self.assertEqual(output.status_code, 200)
# Redirected to the admin index page, after the creation
self.assertTrue(
Expand Down Expand Up @@ -1683,8 +1685,9 @@ def test_admin_process_review(self):
'csrf_token': csrf_token,
}

output = self.app.post('/admin/review/3/process', data=data,
follow_redirects=True)
with fml_testing.mock_sends(CandidateDenied):
output = self.app.post('/admin/review/3/process', data=data,
follow_redirects=True)
self.assertEqual(output.status_code, 200)
self.assertTrue(
'<li class="message">Candidate(s) updated</li>'
Expand Down