def test_when_opened_app_is_for_not_sf(self, update_pdf): sub = factories.FormSubmissionWithOrgsFactory( organizations=[Organization.objects.get(slug='a_pubdef')]) app = sub.applications.first() factories.FillablePDFFactory() PDFService.rebuild_pdf_bundle_for_removed_application(app.id) update_pdf.assert_not_called()
def test_if_app_and_fillable_are_okay(self, create_w_bytes, mock_fill): fillable = factories.FillablePDFFactory() mock_fill.return_value = b'yay bytez' PDFService.fill_pdf_for_application(self.app.id) create_w_bytes.assert_called_once_with( pdf_bytes=b'yay bytez', original_pdf=fillable, submission=self.app.form_submission)
def test_org_user_who_needs_prebuilt_sees_prebuilt_link(self): intake_factories.FillablePDFFactory() prebuilt = intake_factories.PrebuiltPDFBundleFactory() app_ids = intake_factories.make_app_ids_for('sf_pubdef') prebuilt.applications.add(*app_ids) profile = user_accounts_factories.app_reviewer('sf_pubdef') login(self.client, profile) response = self.client.get( query_params.get_url_for_ids(self.view_name, app_ids)) self.assertContains(response, prebuilt.get_absolute_url())
def test_if_fillable_pdf_is_empty(self): fillable = factories.FillablePDFFactory() fillable.pdf = None fillable.save() with self.assertRaises(exceptions.MissingFillablePDFError): PDFService.fill_pdf_for_application(self.app.id)
def preload_fillablepdf(context, county_slug): org = Organization.objects.get(slug=county_slug) factories.FillablePDFFactory(organization=org)