• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python test_base.create_result_form函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tally_ho.libs.tests.test_base.create_result_form函数的典型用法代码示例。如果您正苦于以下问题:Python create_result_form函数的具体用法?Python create_result_form怎么用?Python create_result_form使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了create_result_form函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_women_post_incorrect_ballot_released

 def test_women_post_incorrect_ballot_released(self):
     self._create_and_login_user()
     tally = create_tally()
     tally.users.add(self.user)
     barcode = '123456789'
     ballot = create_ballot(available_for_release=True)
     create_result_form(barcode,
                        tally=tally,
                        ballot=ballot,
                        form_state=FormState.QUALITY_CONTROL)
     result_form = ResultForm.objects.get(barcode=barcode)
     create_quality_control(result_form, self.user)
     create_candidates(result_form, self.user)
     self._add_user_to_group(self.user, groups.QUALITY_CONTROL_CLERK)
     view = views.QualityControlDashboardView.as_view()
     data = {
         'result_form': result_form.pk,
         'incorrect': 1,
         'tally_id': tally.pk,
     }
     request = self.factory.post('/', data=data)
     request.user = self.user
     request.session = {'result_form': result_form.pk}
     response = view(request, tally_id=tally.pk)
     self.assertEqual(response.status_code, 302)
     self.assertIn('quality-control/confirm-reject',
                   response['location'])
     result_form = ResultForm.objects.get(pk=result_form.pk)
     quality_control = result_form.qualitycontrol_set.all()[0]
     self.assertTrue(quality_control.active)
     self.assertEqual(result_form.form_state, FormState.QUALITY_CONTROL)
     self.assertEqual(result_form.rejected_count, 0)
开发者ID:onaio,项目名称:tally-ho,代码行数:32,代码来源:test_quality_control.py


示例2: test_women_get

    def test_women_get(self):
        self._create_and_login_user()
        tally = create_tally()
        tally.users.add(self.user)
        barcode = '123456789'
        center = create_center()
        station = create_station(center=center)
        create_result_form(barcode,
                           center=center,
                           station_number=station.station_number,
                           tally=tally,
                           form_state=FormState.QUALITY_CONTROL)
        result_form = ResultForm.objects.get(barcode=barcode)
        name = 'general candidate name'
        women_name = 'women candidate name'
        votes = 123

        create_candidates(result_form, self.user, name, votes, women_name)

        self._add_user_to_group(self.user, groups.QUALITY_CONTROL_CLERK)
        view = views.QualityControlDashboardView.as_view()
        request = self.factory.get('/')
        request.user = self.user
        request.session = {'result_form': result_form.pk}
        response = view(request, tally_id=tally.pk)
        response.render()
        self.assertEqual(response.status_code, 200)
        self.assertContains(response, 'Women')
        self.assertContains(response, women_name)
        self.assertContains(response, name)
        self.assertContains(response, str(votes))
开发者ID:onaio,项目名称:tally-ho,代码行数:31,代码来源:test_quality_control.py


示例3: test_dashboard_abort_post

    def test_dashboard_abort_post(self):
        self._create_and_login_user()
        tally = create_tally()
        tally.users.add(self.user)
        barcode = '123456789'
        create_result_form(barcode,
                           tally=tally,
                           form_state=FormState.QUALITY_CONTROL)
        self._add_user_to_group(self.user, groups.QUALITY_CONTROL_CLERK)
        result_form = ResultForm.objects.get(barcode=barcode)
        create_quality_control(result_form, self.user)
        view = views.QualityControlDashboardView.as_view()
        data = {
            'result_form': result_form.pk,
            'abort': 1,
            'tally_id': tally.pk,
        }
        request = self.factory.post('/', data=data)
        request.user = self.user
        request.session = {'result_form': result_form.pk}
        response = view(request, tally_id=tally.pk)
        quality_control = result_form.qualitycontrol_set.all()[0]

        self.assertEqual(quality_control.active, False)
        self.assertEqual(response.status_code, 302)
        self.assertIn('quality-control/home',
                      response['location'])
        self.assertEqual(request.session, {})
开发者ID:onaio,项目名称:tally-ho,代码行数:28,代码来源:test_quality_control.py


示例4: test_quality_control_post

 def test_quality_control_post(self):
     barcode = '123456789'
     self._create_and_login_user()
     tally = create_tally()
     tally.users.add(self.user)
     create_result_form(barcode,
                        tally=tally,
                        form_state=FormState.QUALITY_CONTROL)
     self._add_user_to_group(self.user, groups.QUALITY_CONTROL_CLERK)
     view = views.QualityControlView.as_view()
     data = {
         'barcode': barcode,
         'barcode_copy': barcode,
         'tally_id': tally.pk,
     }
     request = self.factory.post('/', data=data)
     request.user = self.user
     request.session = {}
     response = view(request, tally_id=tally.pk)
     self.assertEqual(response.status_code, 302)
     self.assertIn('quality-control/dashboard',
                   response['location'])
     result_form = ResultForm.objects.get(barcode=barcode)
     self.assertEqual(result_form.form_state, FormState.QUALITY_CONTROL)
     self.assertEqual(result_form.qualitycontrol.user, self.user)
开发者ID:onaio,项目名称:tally-ho,代码行数:25,代码来源:test_quality_control.py


示例5: test_dashboard_get

    def test_dashboard_get(self):
        barcode = '123456789'
        self._create_and_login_user()
        center = create_center()
        station = create_station(center=center)
        create_result_form(barcode,
                           center=center,
                           station_number=station.station_number,
                           form_state=FormState.QUALITY_CONTROL)
        result_form = ResultForm.objects.get(barcode=barcode)
        create_candidates(result_form, self.user)
        create_quality_control(result_form, self.user)
        self._add_user_to_group(self.user, groups.QUALITY_CONTROL_ARCHIVE_CLERK)
        view = views.QualityControlDashboardView.as_view()
        request = self.factory.get('/')
        request.user = self.user
        request.session = {'result_form': result_form.pk}
        response = view(request)

        self.assertEqual(response.status_code, 200)
        # gender has been removed
        # self.assertContains(response, str(result_form.gender_name))
        self.assertContains(response, 'General Results Section')
        self.assertNotContains(response, 'Reconciliation')
        self.assertContains(response, 'Abort')
开发者ID:comocho00,项目名称:tally-ho,代码行数:25,代码来源:test_quality_control.py


示例6: test_confirm_form_reset_view_post

    def test_confirm_form_reset_view_post(self):
        self._create_and_login_user()
        tally = create_tally()
        tally.users.add(self.user)
        barcode = '123456789'
        ballot = create_ballot(available_for_release=True)
        create_result_form(barcode,
                           tally=tally,
                           ballot=ballot,
                           form_state=FormState.QUALITY_CONTROL)
        result_form = ResultForm.objects.get(barcode=barcode)
        create_quality_control(result_form, self.user)
        self._add_user_to_group(self.user, groups.QUALITY_CONTROL_CLERK)
        view = views.ConfirmFormResetView.as_view()
        reject_reason = 'Form Incorrect'
        data = {
            'reject_reason': reject_reason
        }
        request = self.factory.post('/', data=data)
        request.user = self.user
        request.session = {'result_form': result_form.pk}
        response = view(request, tally_id=tally.pk)
        result_form = ResultForm.objects.get(pk=result_form.pk)
        quality_control = result_form.qualitycontrol_set.all()[0]

        self.assertEqual(response.status_code, 302)
        self.assertIn('quality-control/reject',
                      response['location'])
        self.assertEqual(request.session, {})
        self.assertEqual(result_form.form_state, FormState.DATA_ENTRY_1)
        self.assertEqual(result_form.rejected_count, 1)
        self.assertEqual(result_form.reject_reason, reject_reason)
        self.assertFalse(quality_control.active)
        self.assertFalse(quality_control.passed_reconciliation)
开发者ID:onaio,项目名称:tally-ho,代码行数:34,代码来源:test_quality_control.py


示例7: test_reconciliation_post_correct

    def test_reconciliation_post_correct(self):
        self._create_and_login_user()
        tally = create_tally()
        tally.users.add(self.user)
        barcode = '123456789'
        create_result_form(barcode,
                           tally=tally,
                           form_state=FormState.QUALITY_CONTROL)
        result_form = ResultForm.objects.get(barcode=barcode)
        create_quality_control(result_form, self.user)
        self._add_user_to_group(self.user, groups.QUALITY_CONTROL_CLERK)
        view = views.QualityControlDashboardView.as_view()
        data = {
            'result_form': result_form.pk,
            'correct': 1,
            'tally_id': tally.pk,
        }
        request = self.factory.post('/', data=data)
        request.user = self.user
        request.session = {'result_form': result_form.pk}
        response = view(request, tally_id=tally.pk)
        result_form.reload()

        self.assertEqual(response.status_code, 302)
        self.assertIn('quality-control/print',
                      response['location'])
        quality_control = QualityControl.objects.get(
            pk=result_form.qualitycontrol.pk)
        self.assertEqual(result_form.form_state, FormState.QUALITY_CONTROL)
        self.assertTrue(quality_control.passed_reconciliation)
开发者ID:onaio,项目名称:tally-ho,代码行数:30,代码来源:test_quality_control.py


示例8: test_duplicate_forms_post

 def test_duplicate_forms_post(self):
     self._create_or_login_intake_clerk()
     tally = create_tally()
     tally.users.add(self.user)
     center = create_center(tally=tally)
     station = create_station(center=center, tally=tally)
     result_form = create_result_form(tally=tally,
                                      center=center,
                                      station_number=station.station_number,
                                      form_state=FormState.DATA_ENTRY_1)
     result_form2 = create_result_form(
         '123456289',
         tally=tally,
         ballot=result_form.ballot,
         center=result_form.center,
         station_number=result_form.station_number,
         serial_number=3)
     view = views.CenterDetailsView.as_view()
     data = {
         'barcode': result_form2.barcode,
         'barcode_copy': result_form2.barcode,
         'tally_id': tally.pk,
     }
     request = self.factory.post('/', data=data)
     request.session = {}
     request.user = self.user
     response = view(request, tally_id=tally.pk)
     self.assertEqual(response.status_code, 302)
     self.assertEqual(request.session['intake-error'],
                      INTAKE_DUPLICATE_ERROR_MESSAGE)
开发者ID:onaio,项目名称:tally-ho,代码行数:30,代码来源:test_intake.py


示例9: test_intake_supervisor

 def test_intake_supervisor(self):
     self._create_and_login_user(username='alice')
     self._create_and_login_user()
     tally = create_tally()
     tally.users.add(self.user)
     form_user = self.user
     barcode = '123456789'
     center = create_center()
     create_result_form(barcode,
                        form_state=FormState.DATA_ENTRY_1,
                        user=form_user,
                        tally=tally,
                        center=center)
     self._add_user_to_group(self.user, groups.INTAKE_SUPERVISOR)
     view = views.CenterDetailsView.as_view()
     barcode_data = {
         'barcode': barcode,
         'barcode_copy': barcode,
         'tally_id': tally.pk,
     }
     request = self.factory.post('/', data=barcode_data)
     request.user = self.user
     request.session = {}
     response = view(request, tally_id=tally.pk)
     self.assertEqual(response.status_code, 302)
     self.assertIn('intake/printcover',
                   response['location'])
     result_form = ResultForm.objects.get(barcode=barcode)
     self.assertEqual(result_form.form_state, FormState.DATA_ENTRY_1)
     self.assertEqual(result_form.user, form_user)
开发者ID:onaio,项目名称:tally-ho,代码行数:30,代码来源:test_intake.py


示例10: test_women_get

    def test_women_get(self):
        barcode = "123456789"
        center = create_center()
        station = create_station(center=center)
        create_result_form(
            barcode, center=center, station_number=station.station_number, form_state=FormState.QUALITY_CONTROL
        )
        result_form = ResultForm.objects.get(barcode=barcode)
        self._create_and_login_user()
        name = "general candidate name"
        women_name = "women candidate name"
        votes = 123

        create_candidates(result_form, self.user, name, votes, women_name)

        self._add_user_to_group(self.user, groups.QUALITY_CONTROL_CLERK)
        view = views.QualityControlDashboardView.as_view()
        request = self.factory.get("/")
        request.user = self.user
        request.session = {"result_form": result_form.pk}
        response = view(request)
        response.render()
        self.assertEqual(response.status_code, 200)
        # gender has been removed
        # self.assertContains(response, str(result_form.gender_name))
        self.assertContains(response, "Women")
        self.assertContains(response, women_name)
        self.assertContains(response, name)
        self.assertContains(response, str(votes))
开发者ID:eavcio,项目名称:tally-ho,代码行数:29,代码来源:test_quality_control.py


示例11: test_women_post_incorrect

    def test_women_post_incorrect(self):
        self._create_and_login_user()
        barcode = "123456789"
        create_result_form(barcode, form_state=FormState.QUALITY_CONTROL)
        result_form = ResultForm.objects.get(barcode=barcode)
        create_quality_control(result_form, self.user)
        create_candidates(result_form, self.user)
        self._add_user_to_group(self.user, groups.QUALITY_CONTROL_CLERK)
        view = views.QualityControlDashboardView.as_view()
        data = {"result_form": result_form.pk, "incorrect": 1}
        request = self.factory.post("/", data=data)
        request.user = self.user
        request.session = {"result_form": result_form.pk}
        response = view(request)
        self.assertEqual(response.status_code, 302)
        self.assertIn("quality-control/reject", response["location"])
        self.assertEqual(result_form.rejected_count, 0)
        result_form = ResultForm.objects.get(pk=result_form.pk)
        quality_control = result_form.qualitycontrol_set.all()[0]

        results = result_form.results.all()
        self.assertTrue(len(results) > 0)

        for result in results:
            self.assertEqual(result.active, False)

        self.assertEqual(result_form.form_state, FormState.DATA_ENTRY_1)
        self.assertEqual(result_form.rejected_count, 1)
        self.assertEqual(quality_control.active, False)
        self.assertEqual(quality_control.passed_women, False)
开发者ID:eavcio,项目名称:tally-ho,代码行数:30,代码来源:test_quality_control.py


示例12: test_dashboard_submit_post

    def test_dashboard_submit_post(self):
        barcode = '123456789'
        create_result_form(barcode,
                           form_state=FormState.QUALITY_CONTROL)
        self._create_and_login_user()
        result_form = ResultForm.objects.get(barcode=barcode)
        quality_control = create_quality_control(result_form, self.user)
        quality_control.passed_general = True
        quality_control.passed_reconciliation = True
        quality_control.passed_women = True
        quality_control.save()

        self._add_user_to_group(self.user, groups.QUALITY_CONTROL_ARCHIVE_CLERK)
        view = views.QualityControlDashboardView.as_view()
        data = {'result_form': result_form.pk,
                'correct': 1}
        request = self.factory.post('/', data=data)
        request.user = self.user
        request.session = {'result_form': result_form.pk}
        response = view(request)
        result_form = ResultForm.objects.get(pk=result_form.pk)

        self.assertEqual(response.status_code, 302)
        self.assertIn('quality-control/success',
                      response['location'])
        self.assertEqual(result_form.form_state, FormState.ARCHIVING)
开发者ID:comocho00,项目名称:tally-ho,代码行数:26,代码来源:test_quality_control.py


示例13: test_center_detail_redirects_no_center

 def test_center_detail_redirects_no_center(self):
     self._create_and_login_user()
     tally = create_tally()
     tally.users.add(self.user)
     barcode = '123456789'
     create_result_form(barcode,
                        form_state=FormState.UNSUBMITTED,
                        tally=tally)
     self._add_user_to_group(self.user, groups.INTAKE_CLERK)
     view = views.CenterDetailsView.as_view()
     barcode_data = {
         'barcode': barcode,
         'barcode_copy': barcode,
         'tally_id': tally.id,
     }
     request = self.factory.post('/', data=barcode_data)
     request.user = self.user
     request.session = {}
     response = view(request, tally_id=tally.pk)
     self.assertEqual(response.status_code, 302)
     self.assertIn('intake/enter-center',
                   response['location'])
     result_form = ResultForm.objects.get(barcode=barcode)
     self.assertEqual(result_form.form_state, FormState.INTAKE)
     self.assertEqual(result_form.user, self.user)
开发者ID:onaio,项目名称:tally-ho,代码行数:25,代码来源:test_intake.py


示例14: test_dashboard_get_forms

    def test_dashboard_get_forms(self):
        create_result_form(form_state=FormState.CLEARANCE,
                           station_number=42)
        response = self._common_view_tests(
            views.DashboardView.as_view())

        self.assertContains(response, 'Clearance')
        self.assertContains(response, '42')
开发者ID:ben12345,项目名称:tally-ho,代码行数:8,代码来源:test_clearance.py


示例15: test_create_clearance_post

    def test_create_clearance_post(self):
        self._create_and_login_user()
        self._add_user_to_group(self.user, groups.CLEARANCE_CLERK)
        barcode = 123456789
        serial_number = 0
        clearable_states = [FormState.CORRECTION,
                            FormState.DATA_ENTRY_1,
                            FormState.DATA_ENTRY_2,
                            FormState.INTAKE,
                            FormState.QUALITY_CONTROL,
                            FormState.ARCHIVING,
                            FormState.UNSUBMITTED]

        for form_state in clearable_states:
            result_form = create_result_form(form_state=form_state,
                                             barcode=barcode,
                                             serial_number=serial_number)
            create_recon_forms(result_form, self.user)
            create_candidates(result_form, self.user)
            view = views.CreateClearanceView.as_view()
            data = {'barcode': result_form.barcode,
                    'barcode_copy': result_form.barcode}
            request = self.factory.post('/', data=data)
            request.user = self.user
            request.session = data
            response = view(request)
            result_form.reload()

            self.assertEqual(response.status_code, 302)
            self.assertEqual(result_form.form_state, FormState.CLEARANCE)
            self.assertIsNotNone(result_form.clearance)
            self.assertEqual(result_form.clearance.user, self.user)

            for result in result_form.reconciliationform_set.all():
                self.assertFalse(result.active)

            for result in result_form.results.all():
                self.assertFalse(result.active)

            barcode = barcode + 1
            serial_number = serial_number + 1

        # unclearable
        result_form = create_result_form(form_state=FormState.ARCHIVED,
                                         barcode=barcode,
                                         serial_number=serial_number)
        view = views.CreateClearanceView.as_view()
        data = {'barcode': result_form.barcode,
                'barcode_copy': result_form.barcode}
        request = self.factory.post('/', data=data)
        request.user = self.user
        request.session = data
        response = view(request)
        result_form.reload()

        self.assertEqual(response.status_code, 200)
        self.assertEqual(result_form.form_state, FormState.ARCHIVED)
开发者ID:ben12345,项目名称:tally-ho,代码行数:57,代码来源:test_clearance.py


示例16: test_create_audit_post

    def test_create_audit_post(self):
        self._create_and_login_user()
        self._add_user_to_group(self.user, groups.AUDIT_CLERK)
        barcode = 123456789
        serial_number = 0
        auditable_states = [FormState.CORRECTION,
                            FormState.ARCHIVING,
                            FormState.DATA_ENTRY_1,
                            FormState.DATA_ENTRY_2,
                            FormState.QUALITY_CONTROL]

        for form_state in auditable_states:
            result_form = create_result_form(form_state=form_state,
                                             barcode=barcode,
                                             serial_number=serial_number)
            create_recon_forms(result_form, self.user)
            create_candidates(result_form, self.user)
            view = views.CreateAuditView.as_view()
            data = {'barcode': result_form.barcode,
                    'barcode_copy': result_form.barcode}
            request = self.factory.post('/', data=data)
            request.user = self.user
            request.session = data
            response = view(request)
            result_form.reload()

            self.assertEqual(response.status_code, 302)
            self.assertEqual(result_form.form_state, FormState.AUDIT)
            self.assertEqual(result_form.audited_count, 1)
            self.assertEqual(result_form.audit.user, self.user)

            for result in result_form.reconciliationform_set.all():
                self.assertFalse(result.active)

            for result in result_form.results.all():
                self.assertFalse(result.active)

            barcode = barcode + 1
            serial_number = serial_number + 1

        # not auditable state
        result_form = create_result_form(form_state=FormState.ARCHIVED,
                                         barcode=barcode,
                                         serial_number=serial_number)
        view = views.CreateAuditView.as_view()
        data = {'barcode': result_form.barcode,
                'barcode_copy': result_form.barcode}
        request = self.factory.post('/', data=data)
        request.user = self.user
        request.session = data
        response = view(request)
        result_form.reload()

        self.assertEqual(response.status_code, 200)
        self.assertEqual(result_form.form_state, FormState.ARCHIVED)
开发者ID:lnabergoi,项目名称:tally-ho,代码行数:55,代码来源:test_audit.py


示例17: test_center_check_replaced_result_form_sent_to_clearance

    def test_center_check_replaced_result_form_sent_to_clearance(self):
        center = create_center(code='11111')
        station = create_station(center)
        ballot = create_ballot()
        barcode = '123456789'
        replacement_barcode = '012345678'
        create_result_form(
            barcode=barcode,
            ballot=ballot,
            form_state=FormState.UNSUBMITTED,
            center=center,
            station_number=station.station_number
        )
        replacement_result_form = create_result_form(
            barcode=replacement_barcode,
            ballot=ballot,
            form_state=FormState.INTAKE,
            serial_number=1
        )

        self._create_and_login_user()
        self._add_user_to_group(self.user, groups.INTAKE_CLERK)
        view = views.EnterCenterView.as_view()
        data = {'result_form': replacement_result_form.pk,
                'center_number': center.code,
                'center_number_copy': center.code,
                'station_number': station.station_number,
                'station_number_copy': station.station_number}
        request = self.factory.post('/',
                                    data=data)
        request.user = self.user
        request.session = {'result_form': replacement_result_form.pk}
        response = view(request)
        replacement_result_form.reload()
        self.assertEqual(replacement_result_form.form_state, FormState.INTAKE)
        self.assertEqual(replacement_result_form.station_number,
                         station.station_number)
        self.assertEqual(replacement_result_form.center, center)
        self.assertEqual(response.status_code, 302)
        self.assertIn('/intake/check-center-details', response['location'])

        view = views.CenterDetailsView.as_view()
        barcode_data = {'barcode': barcode, 'barcode_copy': barcode}
        request = self.factory.post('/', data=barcode_data)
        request.user = self.user
        request.session = {}
        response = view(request)
        self.assertEqual(response.status_code, 302)
        self.assertIn('/intake/clearance', response['location'])
        result_form = ResultForm.objects.get(barcode=barcode)
        self.assertEqual(result_form.form_state, FormState.CLEARANCE)
开发者ID:ben12345,项目名称:tally-ho,代码行数:51,代码来源:test_intake.py


示例18: test_archive_post_supervisor

    def test_archive_post_supervisor(self):
        self._create_and_login_user()
        barcode = '123456789'
        create_result_form(form_state=FormState.ARCHIVED)
        self._add_user_to_group(self.user, groups.ARCHIVE_SUPERVISOR)
        view = views.ArchiveView.as_view()
        data = {'barcode': barcode, 'barcode_copy': barcode}
        request = self.factory.post('/', data=data)
        request.session = {}
        request.user = self.user
        response = view(request)

        self.assertEqual(response.status_code, 302)
        self.assertIn('archive/print', response['location'])
开发者ID:ben12345,项目名称:tally-ho,代码行数:14,代码来源:test_archive.py


示例19: test_dashboard_get_csv

 def test_dashboard_get_csv(self):
     self._create_and_login_user()
     self._add_user_to_group(self.user, groups.CLEARANCE_CLERK)
     tally = create_tally()
     tally.users.add(self.user)
     create_result_form(form_state=FormState.CLEARANCE,
                        tally=tally)
     view = views.DashboardView.as_view()
     request = self.factory.get('/')
     request.user = self.user
     request.session = {}
     response = view(request, tally_id=tally.pk, format='csv')
     self.assertEqual(response.status_code, 200)
     self.assertEqual(response.get('Content-Type'), 'text/csv')
开发者ID:onaio,项目名称:tally-ho,代码行数:14,代码来源:test_clearance.py


示例20: test_enter_results_success_data_entry_two

    def test_enter_results_success_data_entry_two(self):
        code = '12345'
        center = create_center(code)
        create_station(center)
        result_form = create_result_form(form_state=FormState.DATA_ENTRY_2,
                                         center=center)
        ballot = result_form.ballot
        candidate_name = 'candidate name'
        create_candidate(ballot, candidate_name)

        self._create_and_login_user()
        self._add_user_to_group(self.user, groups.DATA_ENTRY_2_CLERK)

        response = self._post_enter_results(result_form)

        self.assertEqual(response.status_code, 302)
        self.assertIn('data-entry',
                      response['location'])
        updated_result_form = ResultForm.objects.get(pk=result_form.pk)
        self.assertEqual(updated_result_form.form_state,
                         FormState.CORRECTION)

        reconciliation_forms = updated_result_form.reconciliationform_set.all()
        self.assertEqual(len(reconciliation_forms), 1)

        self.assertEqual(reconciliation_forms[0].entry_version,
                         EntryVersion.DATA_ENTRY_2)

        results = updated_result_form.results.all()
        self.assertEqual(len(results), 1)
        self.assertEqual(results[0].entry_version, EntryVersion.DATA_ENTRY_2)
        self.assertEqual(results[0].user, self.user)
开发者ID:ben12345,项目名称:tally-ho,代码行数:32,代码来源:test_data_entry.py



注:本文中的tally_ho.libs.tests.test_base.create_result_form函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python test_base.create_station函数代码示例发布时间:2022-05-27
下一篇:
Python test_base.create_center函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap