def test_if_pdf_bundle_exists_for_all_apps(self): prebuilt = factories.PrebuiltPDFBundleFactory() matching_apps = factories.make_app_ids_for_sf() prebuilt.applications.add(*matching_apps) result = PDFService.get_prebuilt_pdf_bundle_for_app_id_set( matching_apps) self.assertEqual(prebuilt, result)
def test_if_pdf_bundle_exists_for_all_apps(self): prebuilt = factories.PrebuiltPDFBundleFactory() matching_apps = factories.make_app_ids_for_sf() prebuilt.applications.add(*matching_apps) result = PDFService.get_prebuilt_pdf_bundle_for_app_id_set( matching_apps) self.assertEqual(prebuilt, result)
def test_applicant_in_prebuilt_pdf_for_org(context, applicant_names, org_slug): applicant_names = oxford_comma_text_to_list(applicant_names) app_ids = [] for applicant_name in applicant_names: first_name, last_name = applicant_name.split(' ') app_ids.append( models.Application.objects.filter( form_submission__first_name=first_name, form_submission__last_name=last_name, organization__slug=org_slug).first().id) prebuilt = pdf_service.get_prebuilt_pdf_bundle_for_app_id_set(app_ids) context.test.assertTrue(prebuilt)
def test_applicant_in_prebuilt_pdf_for_org(context, applicant_names, org_slug): applicant_names = oxford_comma_text_to_list(applicant_names) app_ids = [] for applicant_name in applicant_names: first_name, last_name = applicant_name.split(' ') app_ids.append( models.Application.objects.filter( form_submission__first_name=first_name, form_submission__last_name=last_name, organization__slug=org_slug).first().id) prebuilt = pdf_service.get_prebuilt_pdf_bundle_for_app_id_set(app_ids) context.test.assertTrue(prebuilt)
def test_bundles_with_same_count_but_different_apps_are_excluded(self): other_prebuilt = factories.PrebuiltPDFBundleFactory() not_matching_apps = factories.make_app_ids_for_sf(count=2) other_prebuilt.applications.add(*not_matching_apps) expected_prebuilt = factories.PrebuiltPDFBundleFactory() matching_apps = factories.make_app_ids_for_sf(count=2) expected_prebuilt.applications.add(*matching_apps) result = PDFService.get_prebuilt_pdf_bundle_for_app_id_set( matching_apps) self.assertNotEqual(other_prebuilt, result) self.assertEqual(expected_prebuilt, result)
def test_bundles_with_same_count_but_different_apps_are_excluded(self): other_prebuilt = factories.PrebuiltPDFBundleFactory() not_matching_apps = factories.make_app_ids_for_sf(count=2) other_prebuilt.applications.add(*not_matching_apps) expected_prebuilt = factories.PrebuiltPDFBundleFactory() matching_apps = factories.make_app_ids_for_sf(count=2) expected_prebuilt.applications.add(*matching_apps) result = PDFService.get_prebuilt_pdf_bundle_for_app_id_set( matching_apps) self.assertNotEqual(other_prebuilt, result) self.assertEqual(expected_prebuilt, result)
def test_if_no_pdf_bundles_exist(self): apps = factories.make_app_ids_for_sf() result = PDFService.get_prebuilt_pdf_bundle_for_app_id_set(apps) self.assertEqual(None, result)
def test_if_no_pdf_bundles_exist(self): apps = factories.make_app_ids_for_sf() result = PDFService.get_prebuilt_pdf_bundle_for_app_id_set(apps) self.assertEqual(None, result)