test_county_application_view.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:intake 作者: codeforamerica 项目源码 文件源码
def test_validation_warnings(self, send_confirmation):
        applicant = factories.ApplicantFactory.create()
        self.set_form_session_data(
            counties=['sanfrancisco'], applicant_id=applicant.id)
        with self.assertLogs(
                'project.services.logging_service', logging.INFO) as logs:
            response = self.client.fill_form(
                reverse(self.view_name),
                **mock.fake.sf_pubdef_answers(ssn=''))
        self.assertRedirects(
            response, reverse('intake-confirm'), fetch_redirect_response=False)
        response = self.client.get(response.url)
        self.assertContains(response, escape(WARNING_FLASH_MESSAGE))
        self.assertContains(
            response,
            escape(
                fields.SocialSecurityNumberField.is_recommended_error_message))
        send_confirmation.assert_not_called()
        assertInLogsCount(
            logs, {
                'event_name=application_page_complete': 1,
                'event_name=application_started': 0,
                'event_name=application_submitted': 0,
                'event_name=application_errors': 0,
                })
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号