Skip to content

Commit

Permalink
Remove blank ballots quarantine triggers tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnMwashuma committed Aug 12, 2024
1 parent 160e6c9 commit 0a18a3a
Showing 1 changed file with 0 additions and 99 deletions.
99 changes: 0 additions & 99 deletions tally_ho/apps/tally/tests/views/test_quality_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -1137,105 +1137,6 @@ def test_quality_control_quarantine_pass_votes_candidate_percentage(self):
self.assertEqual(result_form.audited_count, 0)
self.assertIn('quality-control/print', response['location'])

def test_quality_control_quarantine_pass_blank_ballots_trigger(self):
"""
Test blank ballots check is not triggered when the percentage of
blank ballots has not exceeded the allowed percentage value.
"""
center = create_center()
station = create_station(center=center, registrants=21)
quarantine_data = copy.deepcopy(self.quarantine_data)
quarantine_data[9]['active'] = True
create_quarantine_checks(quarantine_data)
result_form = create_result_form(
tally=self.tally,
form_state=FormState.QUALITY_CONTROL,
center=center,
station_number=station.station_number)
create_reconciliation_form(
result_form=result_form,
user=self.user,
number_ballots_inside_box=21,
number_cancelled_ballots=0,
number_spoiled_ballots=0,
number_unstamped_ballots=0,
number_unused_ballots=0,
number_valid_votes=20,
number_ballots_received=21,
number_signatures_in_vr=21,
)
create_quality_control(result_form, self.user)
create_candidates(result_form, self.user, votes=1, num_results=10)
self._add_user_to_group(self.user, groups.QUALITY_CONTROL_CLERK)
view = views.QualityControlDashboardView.as_view()
data = {
'correct': 1,
'result_form': result_form.pk,
'tally_id': self.tally.pk,
}
request = self.factory.post('/', data=data)
request.session = {'result_form': result_form.pk}
request.user = self.user
response = view(request, tally_id=self.tally.pk)
result_form.reload()

self.assertEqual(response.status_code, 302)
self.assertEqual(result_form.form_state, FormState.QUALITY_CONTROL)
self.assertIsNone(result_form.audit)
self.assertEqual(result_form.audited_count, 0)
self.assertIn('quality-control/print', response['location'])

def test_quality_control_quarantine_fail_blank_ballots_trigger(self):
"""
Test blank ballots check is triggered when the percentage of
blank ballots exceeds the allowed percentage value.
"""
center = create_center()
station = create_station(center=center, registrants=21)
quarantine_data = copy.deepcopy(self.quarantine_data)
quarantine_data[9]['active'] = True
create_quarantine_checks(quarantine_data)
result_form = create_result_form(
tally=self.tally,
form_state=FormState.QUALITY_CONTROL,
center=center,
station_number=station.station_number)
create_reconciliation_form(
result_form=result_form,
user=self.user,
number_ballots_inside_box=21,
number_cancelled_ballots=0,
number_spoiled_ballots=0,
number_unstamped_ballots=0,
number_unused_ballots=0,
number_valid_votes=20,
number_ballots_received=21,
number_signatures_in_vr=21,
)
create_quality_control(result_form, self.user)
create_candidates(result_form, self.user, votes=1, num_results=10)
self._add_user_to_group(self.user, groups.QUALITY_CONTROL_CLERK)
view = views.QualityControlDashboardView.as_view()
data = {
'correct': 1,
'result_form': result_form.pk,
'tally_id': self.tally.pk,
}
request = self.factory.post('/', data=data)
request.session = {'result_form': result_form.pk}
request.user = self.user
response = view(request, tally_id=self.tally.pk)
result_form.reload()

self.assertEqual(response.status_code, 302)
self.assertEqual(result_form.form_state, FormState.QUALITY_CONTROL)
self.assertIsNotNone(result_form.audit)
self.assertEqual(result_form.audited_count, 1)
self.assertEqual(
result_form.audit.quarantine_checks.all()[0].name,
quarantine_data[9]['name'])
self.assertIn('/quality-control/print', response['location'])

def test_quality_control_post_quarantine(self):
"""
Test quality control post
Expand Down

0 comments on commit 0a18a3a

Please sign in to comment.