From a6dd17cd0e6622692c742e35da460ecf9100fa77 Mon Sep 17 00:00:00 2001 From: pavlo-mk Date: Mon, 23 Dec 2024 07:11:56 +0100 Subject: [PATCH] fix e2e --- tests/selenium/filters/test_filters.py | 31 ++-- .../test_managerial_console.py | 19 +- .../payment_module/test_payment_plans.py | 2 +- .../test_payment_verification.py | 9 +- .../program_details/test_program_details.py | 16 +- tests/selenium/targeting/test_targeting.py | 169 ++++++++++-------- 6 files changed, 120 insertions(+), 126 deletions(-) diff --git a/tests/selenium/filters/test_filters.py b/tests/selenium/filters/test_filters.py index 8b78fb29ff..2fa36a8dcc 100644 --- a/tests/selenium/filters/test_filters.py +++ b/tests/selenium/filters/test_filters.py @@ -24,11 +24,7 @@ from hct_mis_api.apps.program.models import BeneficiaryGroup, Program from hct_mis_api.apps.registration_data.fixtures import RegistrationDataImportFactory from hct_mis_api.apps.registration_data.models import ImportData, RegistrationDataImport -from hct_mis_api.apps.targeting.fixtures import ( - TargetingCriteriaFactory, - TargetPopulationFactory, -) -from hct_mis_api.apps.targeting.models import TargetPopulation +from hct_mis_api.apps.targeting.fixtures import TargetingCriteriaFactory from tests.selenium.page_object.filters import Filters from tests.selenium.page_object.grievance.details_grievance_page import ( GrievanceDetailsPage, @@ -44,14 +40,17 @@ @pytest.fixture def create_payment_plan() -> None: - tp = TargetPopulation.objects.all()[0] - tp2 = TargetPopulation.objects.all()[1] + ba = BusinessArea.objects.get(slug="afghanistan") + targeting_criteria = TargetingCriteriaFactory() + targeting_criteria_2 = TargetingCriteriaFactory() + program_1 = ProgramFactory(business_area=ba) + program_2 = ProgramFactory(business_area=ba) pp = PaymentPlan.objects.update_or_create( name="Test Payment Plan 1", unicef_id="PP-0060-22-11223344", - business_area=BusinessArea.objects.only("is_payment_plan_applicable").get(slug="afghanistan"), - target_population=tp, + business_area=ba, + targeting_criteria=targeting_criteria, start_date=datetime.now(), end_date=datetime.now() + relativedelta(days=30), currency="USD", @@ -63,15 +62,15 @@ def create_payment_plan() -> None: total_delivered_quantity=999, total_entitled_quantity=2999, is_follow_up=False, - program_cycle=tp.program.cycles.first(), + program_cycle=program_1.cycles.first(), ) pp[0].unicef_id = "PP-0060-22-11223344" pp[0].save() PaymentPlan.objects.update_or_create( name="Test Payment Plan 2", - business_area=BusinessArea.objects.only("is_payment_plan_applicable").get(slug="afghanistan"), - target_population=tp2, + business_area=ba, + targeting_criteria=targeting_criteria_2, start_date=datetime.now(), end_date=datetime.now() + relativedelta(days=30), currency="USD", @@ -83,7 +82,7 @@ def create_payment_plan() -> None: total_delivered_quantity=999, total_entitled_quantity=2999, is_follow_up=False, - program_cycle=tp2.program.cycles.first(), + program_cycle=program_2.cycles.first(), ) @@ -222,17 +221,19 @@ def add_payment_verification() -> None: def create_targeting() -> None: user = User.objects.first() business_area = BusinessArea.objects.get(slug="afghanistan") - TargetPopulationFactory( + PaymentPlanFactory( name="Test", created_by=user, targeting_criteria=TargetingCriteriaFactory(), business_area=business_area, + status=PaymentPlan.Status.TP_OPEN, ) - TargetPopulationFactory( + PaymentPlanFactory( name="Targeting 2", created_by=user, targeting_criteria=TargetingCriteriaFactory(), business_area=business_area, + status=PaymentPlan.Status.TP_OPEN, ) diff --git a/tests/selenium/managerial_console/test_managerial_console.py b/tests/selenium/managerial_console/test_managerial_console.py index 175e06a605..376c714678 100644 --- a/tests/selenium/managerial_console/test_managerial_console.py +++ b/tests/selenium/managerial_console/test_managerial_console.py @@ -15,11 +15,7 @@ from hct_mis_api.apps.payment.models import PaymentPlan from hct_mis_api.apps.program.fixtures import ProgramCycleFactory, ProgramFactory from hct_mis_api.apps.program.models import BeneficiaryGroup, Program -from hct_mis_api.apps.targeting.fixtures import ( - TargetingCriteriaFactory, - TargetPopulationFactory, -) -from hct_mis_api.apps.targeting.models import TargetPopulation +from hct_mis_api.apps.targeting.fixtures import TargetingCriteriaFactory from tests.selenium.page_object.managerial_console.managerial_console import ( ManagerialConsole, ) @@ -63,29 +59,22 @@ def create_program( def create_payment_plan(create_active_test_program: Program, second_test_program: Program) -> PaymentPlan: program_cycle_second = ProgramCycleFactory(program=second_test_program) PaymentPlanFactory( - target_population=TargetPopulationFactory(program=second_test_program), program_cycle=program_cycle_second, status=PaymentPlan.Status.IN_APPROVAL, business_area=BusinessArea.objects.filter(slug="afghanistan").first(), ) - targeting_criteria = TargetingCriteriaFactory() - TargetPopulationFactory( - program=create_active_test_program, - status=TargetPopulation.STATUS_OPEN, - targeting_criteria=targeting_criteria, - ) - tp = TargetPopulation.objects.get(program__name="Test Programm") + payment_plan = PaymentPlan.objects.update_or_create( name="Test Payment Plan", business_area=BusinessArea.objects.only("is_payment_plan_applicable").get(slug="afghanistan"), - target_population=tp, + targeting_criteria=TargetingCriteriaFactory(), currency="USD", dispersion_start_date=datetime.now(), dispersion_end_date=datetime.now() + relativedelta(days=14), status_date=datetime.now(), status=PaymentPlan.Status.IN_APPROVAL, created_by=User.objects.first(), - program_cycle=tp.program.cycles.first(), + program_cycle=create_active_test_program.cycles.first(), total_delivered_quantity=999, total_entitled_quantity=2999, is_follow_up=False, diff --git a/tests/selenium/payment_module/test_payment_plans.py b/tests/selenium/payment_module/test_payment_plans.py index 03ad0a16c8..021d79fc4b 100644 --- a/tests/selenium/payment_module/test_payment_plans.py +++ b/tests/selenium/payment_module/test_payment_plans.py @@ -363,7 +363,7 @@ def test_smoke_payment_plan(self, create_payment_plan: PaymentPlan, pagePaymentM assert "Dispersion End Date" in pagePaymentModule.getTableLabel()[9].text assert "Follow-up Payment Plans" in pagePaymentModule.getTableLabel()[10].text assert "ACCEPTED" in pagePaymentModule.getStatusContainer().text - assert "Rows per page: 5 1–2 of 2" in pagePaymentModule.getTablePagination().text.replace("\n", " ") + assert "Rows per page: 5 1–1 of 1" in pagePaymentModule.getTablePagination().text.replace("\n", " ") def test_smoke_new_payment_plan( self, diff --git a/tests/selenium/payment_verification/test_payment_verification.py b/tests/selenium/payment_verification/test_payment_verification.py index ba88b48bc2..d931005c4b 100644 --- a/tests/selenium/payment_verification/test_payment_verification.py +++ b/tests/selenium/payment_verification/test_payment_verification.py @@ -195,9 +195,8 @@ def add_payment_verification_xlsx() -> PV: def payment_verification_creator(channel: str = PaymentVerificationPlan.VERIFICATION_CHANNEL_MANUAL) -> PV: user = User.objects.first() - registration_data_import = RegistrationDataImportFactory( - imported_by=user, business_area=BusinessArea.objects.first() - ) + business_area = BusinessArea.objects.first() + registration_data_import = RegistrationDataImportFactory(imported_by=user, business_area=business_area) program = Program.objects.filter(name="Active Program").first() household, individuals = create_household( { @@ -212,7 +211,7 @@ def payment_verification_creator(channel: str = PaymentVerificationPlan.VERIFICA name="TEST", status=PaymentPlan.Status.FINISHED, program_cycle=program.cycles.first(), - business_area=BusinessArea.objects.first(), + business_area=business_area, start_date=datetime.now() - relativedelta(months=1), end_date=datetime.now() + relativedelta(months=1), created_by=user, @@ -363,7 +362,7 @@ def test_happy_path_payment_verification( assert "DELIVERED FULLY" in pagePaymentRecord.getLabelStatus()[0].text assert "DELIVERED FULLY" in pagePaymentRecord.getStatusContainer().text assert payment_record.household.unicef_id in pagePaymentRecord.getLabelHousehold().text - assert payment_record.parent.target_population.name in pagePaymentRecord.getLabelTargetPopulation().text + assert payment_record.parent.name in pagePaymentRecord.getLabelTargetPopulation().text assert payment_record.parent.unicef_id in pagePaymentRecord.getLabelDistributionModality().text assert payment_record.payment_verifications.first().status in pagePaymentRecord.getLabelStatus()[1].text assert "PLN 0.00" in pagePaymentRecord.getLabelAmountReceived().text diff --git a/tests/selenium/program_details/test_program_details.py b/tests/selenium/program_details/test_program_details.py index a60d2913f0..fad3bd7ff6 100644 --- a/tests/selenium/program_details/test_program_details.py +++ b/tests/selenium/program_details/test_program_details.py @@ -17,11 +17,7 @@ from hct_mis_api.apps.program.fixtures import ProgramCycleFactory, ProgramFactory from hct_mis_api.apps.program.models import BeneficiaryGroup, Program, ProgramCycle from hct_mis_api.apps.registration_data.fixtures import RegistrationDataImportFactory -from hct_mis_api.apps.targeting.fixtures import ( - TargetingCriteriaFactory, - TargetPopulationFactory, -) -from hct_mis_api.apps.targeting.models import TargetPopulation +from hct_mis_api.apps.targeting.fixtures import TargetingCriteriaFactory from tests.selenium.helpers.date_time_format import FormatTime from tests.selenium.page_object.programme_details.programme_details import ( ProgrammeDetails, @@ -205,16 +201,10 @@ def create_custom_household() -> Household: def create_payment_plan(standard_program: Program) -> PaymentPlan: targeting_criteria = TargetingCriteriaFactory() cycle = standard_program.cycles.first() - tp = TargetPopulationFactory( - program=standard_program, - status=TargetPopulation.STATUS_OPEN, - targeting_criteria=targeting_criteria, - program_cycle=cycle, - ) payment_plan = PaymentPlan.objects.update_or_create( name="Test Payment Plan", - business_area=BusinessArea.objects.only("is_payment_plan_applicable").get(slug="afghanistan"), - target_population=tp, + business_area=BusinessArea.objects.get(slug="afghanistan"), + targeting_criteria=targeting_criteria, start_date=datetime.now(), end_date=datetime.now() + relativedelta(days=30), currency="USD", diff --git a/tests/selenium/targeting/test_targeting.py b/tests/selenium/targeting/test_targeting.py index 3b5d0202fc..2cf0c2fd5b 100644 --- a/tests/selenium/targeting/test_targeting.py +++ b/tests/selenium/targeting/test_targeting.py @@ -19,12 +19,15 @@ from hct_mis_api.apps.household.fixtures import ( HouseholdFactory, IndividualFactory, + IndividualRoleInHouseholdFactory, create_household_and_individuals, + create_household_with_individual_with_collectors, ) from hct_mis_api.apps.household.models import ( HEARING, HOST, REFUGEE, + ROLE_PRIMARY, SEEING, Household, Individual, @@ -33,24 +36,28 @@ FinancialServiceProviderFactory, FinancialServiceProviderXlsxTemplateFactory, FspXlsxTemplatePerDeliveryMechanismFactory, + PaymentPlanFactory, generate_delivery_mechanisms, ) -from hct_mis_api.apps.payment.models import DeliveryMechanism, FinancialServiceProvider +from hct_mis_api.apps.payment.models import ( + DeliveryMechanism, + FinancialServiceProvider, + PaymentPlan, +) +from hct_mis_api.apps.payment.services.payment_plan_services import PaymentPlanService from hct_mis_api.apps.periodic_data_update.utils import ( field_label_to_field_name, populate_pdu_with_null_values, ) from hct_mis_api.apps.program.fixtures import ProgramFactory -from hct_mis_api.apps.program.models import BeneficiaryGroup, Program +from hct_mis_api.apps.program.models import BeneficiaryGroup, Program, ProgramCycle from hct_mis_api.apps.registration_data.fixtures import RegistrationDataImportFactory from hct_mis_api.apps.steficon.fixtures import RuleCommitFactory, RuleFactory from hct_mis_api.apps.steficon.models import Rule from hct_mis_api.apps.targeting.fixtures import ( TargetingCriteriaFactory, - TargetPopulationFactory, + TargetingCriteriaRuleFactory, ) -from hct_mis_api.apps.targeting.models import TargetPopulation -from hct_mis_api.apps.targeting.services.targeting_stats_refresher import refresh_stats from tests.selenium.page_object.filters import Filters from tests.selenium.page_object.targeting.targeting import Targeting from tests.selenium.page_object.targeting.targeting_create import TargetingCreate @@ -93,19 +100,18 @@ def individual() -> Callable: def _individual(program: Program) -> Individual: business_area = create_afghanistan() rdi = RegistrationDataImportFactory() - household, individuals = create_household_and_individuals( - household_data={ + + household, individuals = create_household_with_individual_with_collectors( + household_args={ + "business_area": business_area, + "program_id": program.pk, + "registration_data_import": rdi, + }, + individual_args={ "business_area": business_area, "program_id": program.pk, "registration_data_import": rdi, }, - individuals_data=[ - { - "business_area": business_area, - "program_id": program.pk, - "registration_data_import": rdi, - }, - ], ) individual = individuals[0] individual.flex_fields = populate_pdu_with_null_values(program, individual.flex_fields) @@ -237,113 +243,108 @@ def get_program_with_dct_type_and_name( @pytest.fixture -def create_targeting() -> TargetPopulation: - create_test_program = Program.objects.filter(name="Test Programm").first() +def create_targeting() -> PaymentPlan: + test_program = Program.objects.get(name="Test Programm") generate_delivery_mechanisms() dm_cash = DeliveryMechanism.objects.get(code="cash") + business_area = BusinessArea.objects.get(slug="afghanistan") targeting_criteria = TargetingCriteriaFactory() - - tp = TargetPopulationFactory( + pp = PaymentPlanFactory( name="Test Target Population", - program=create_test_program, - status=TargetPopulation.STATUS_OPEN, + status=PaymentPlan.Status.TP_OPEN, targeting_criteria=targeting_criteria, - program_cycle=create_test_program.cycles.first(), - build_status=TargetPopulation.BUILD_STATUS_OK, + program_cycle=test_program.cycles.first(), + build_status=PaymentPlan.BuildStatus.BUILD_STATUS_OK, ) - program = tp.program hoh1 = IndividualFactory(household=None) hoh2 = IndividualFactory(household=None) household_1 = HouseholdFactory( - program=program, + program=test_program, id="3d7087be-e8f8-478d-9ca2-4ca6d5e96f51", unicef_id="HH-17-0000.3340", head_of_household=hoh1, size=5, ) household_2 = HouseholdFactory( - program=program, + program=test_program, id="3d7087be-e8f8-478d-9ca2-4ca6d5e96f52", unicef_id="HH-17-0000.3341", head_of_household=hoh2, size=6, ) - # HH1 - Female Children: 1; Female Adults: 1; Male Children: 2; Male Adults: 1; - IndividualFactory( + ind_1 = IndividualFactory( household=household_1, - program=program, + program=test_program, sex="MALE", birth_date=factory.Faker("date_of_birth", tzinfo=utc, minimum_age=11, maximum_age=16), ) IndividualFactory( household=household_1, - program=program, + program=test_program, sex="MALE", birth_date=factory.Faker("date_of_birth", tzinfo=utc, minimum_age=11, maximum_age=16), ) IndividualFactory( household=household_1, - program=program, + program=test_program, sex="FEMALE", birth_date=factory.Faker("date_of_birth", tzinfo=utc, minimum_age=1, maximum_age=10), ) IndividualFactory( household=household_1, - program=program, + program=test_program, sex="FEMALE", birth_date=factory.Faker("date_of_birth", tzinfo=utc, minimum_age=20, maximum_age=40), ) IndividualFactory( household=household_1, - program=program, + program=test_program, sex="MALE", unicef_id="IND-06-0001.1828", birth_date=factory.Faker("date_of_birth", tzinfo=utc, minimum_age=20, maximum_age=40), ) - # HH2 - Female Children: 4; Female Adults: 1; Male Children: 1; Male Adults: 0; - IndividualFactory( + ind_2 = IndividualFactory( household=household_2, - program=program, + program=test_program, sex="MALE", birth_date=factory.Faker("date_of_birth", tzinfo=utc, minimum_age=1, maximum_age=3), ) IndividualFactory( household=household_2, - program=program, + program=test_program, sex="FEMALE", birth_date=factory.Faker("date_of_birth", tzinfo=utc, minimum_age=1, maximum_age=10), ) IndividualFactory( household=household_2, - program=program, + program=test_program, sex="FEMALE", birth_date=factory.Faker("date_of_birth", tzinfo=utc, minimum_age=1, maximum_age=10), ) IndividualFactory( household=household_2, - program=program, + program=test_program, sex="FEMALE", birth_date=factory.Faker("date_of_birth", tzinfo=utc, minimum_age=1, maximum_age=10), ) IndividualFactory( household=household_2, - program=program, + program=test_program, sex="FEMALE", birth_date=factory.Faker("date_of_birth", tzinfo=utc, minimum_age=1, maximum_age=10), ) IndividualFactory( household=household_2, - program=program, + program=test_program, sex="FEMALE", birth_date=factory.Faker("date_of_birth", tzinfo=utc, minimum_age=30, maximum_age=45), ) - - tp.households.set([household_1, household_2]) - business_area = BusinessArea.objects.get(slug="afghanistan") + IndividualRoleInHouseholdFactory(individual=ind_1, household=household_1, role=ROLE_PRIMARY) + IndividualRoleInHouseholdFactory(individual=ind_2, household=household_2, role=ROLE_PRIMARY) rule = RuleFactory( name="Test Rule", type=Rule.TYPE_PAYMENT_PLAN, @@ -368,10 +369,15 @@ def create_targeting() -> TargetPopulation: xlsx_template=fsp_xlsx_template, delivery_mechanism=dm_cash, ) - tp.refresh_from_db() - tp = refresh_stats(tp) - tp.save() - yield tp + TargetingCriteriaRuleFactory( + household_ids=f"{household_1.unicef_id}, {household_2.unicef_id}", + individual_ids="", + targeting_criteria=targeting_criteria, + ) + PaymentPlanService.create_payments(pp) + pp.update_population_count_fields() + pp.refresh_from_db() + yield pp @pytest.fixture @@ -392,9 +398,13 @@ def create_programs() -> None: @pytest.mark.usefixtures("login") class TestSmokeTargeting: def test_smoke_targeting_page( - self, create_programs: None, create_targeting: TargetPopulation, pageTargeting: Targeting + self, create_programs: None, create_targeting: PaymentPlan, pageTargeting: Targeting ) -> None: - TargetPopulationFactory(program=Program.objects.get(name="Test Programm"), name="Copy TP") + PaymentPlanFactory( + program_cycle=ProgramCycle.objects.get(program__name="Test Programm"), + name="Copy TP", + status=PaymentPlan.Status.TP_OPEN, + ) pageTargeting.selectGlobalProgramFilter("Test Programm") pageTargeting.getNavTargeting().click() assert "Targeting" in pageTargeting.getTitlePage().text @@ -414,7 +424,7 @@ def test_smoke_targeting_page( def test_smoke_targeting_create_use_filters( self, create_programs: None, - create_targeting: TargetPopulation, + create_targeting: PaymentPlan, pageTargeting: Targeting, pageTargetingCreate: TargetingCreate, ) -> None: @@ -432,7 +442,7 @@ def test_smoke_targeting_create_use_filters( def test_smoke_targeting_create_use_ids( self, create_programs: None, - create_targeting: TargetPopulation, + create_targeting: PaymentPlan, pageTargeting: Targeting, pageTargetingCreate: TargetingCreate, ) -> None: @@ -451,7 +461,7 @@ def test_smoke_targeting_create_use_ids( def test_smoke_targeting_details_page( self, create_programs: None, - create_targeting: TargetPopulation, + create_targeting: PaymentPlan, pageTargeting: Targeting, pageTargetingDetails: TargetingDetails, ) -> None: @@ -881,7 +891,10 @@ def test_create_targeting_for_people_with_pdu( assert pageTargetingCreate.getAddPeopleRuleButton().text.upper() == "ADD PEOPLE RULE" pageTargetingCreate.getAddPeopleRuleButton().click() pageTargetingCreate.getTargetingCriteriaAutoComplete().click() - pageTargetingCreate.select_listbox_element("Test String Attribute SW") + # pageTargetingCreate.select_listbox_element("Test String Attribute SW") # not works + pageTargetingCreate.getTargetingCriteriaAutoComplete().send_keys("Test String Attribute") + pageTargetingCreate.getTargetingCriteriaAutoComplete().send_keys(Keys.ARROW_DOWN) + pageTargetingCreate.getTargetingCriteriaAutoComplete().send_keys(Keys.ENTER) pageTargetingCreate.getSelectFiltersRoundNumber().click() pageTargetingCreate.getSelectRoundOption(1).click() pageTargetingCreate.getInputFiltersValue().send_keys("Text") @@ -908,7 +921,7 @@ def test_targeting_create_use_ids_hh( self, create_programs: None, household_with_disability: Household, - create_targeting: TargetPopulation, + create_targeting: PaymentPlan, pageTargeting: Targeting, pageTargetingDetails: TargetingDetails, pageTargetingCreate: TargetingCreate, @@ -925,9 +938,7 @@ def test_targeting_create_use_ids_hh( pageTargetingCreate.getTargetingCriteriaAddDialogSaveButton().click() pageTargetingCreate.getInputName().send_keys(f"Target Population for {household_with_disability.unicef_id}") pageTargetingCreate.clickButtonTargetPopulationCreate() - target_population = TargetPopulation.objects.get( - name=f"Target Population for {household_with_disability.unicef_id}" - ) + target_population = PaymentPlan.objects.get(name=f"Target Population for {household_with_disability.unicef_id}") assert str(target_population.total_individuals_count) == pageTargetingDetails.getLabelTargetedIndividuals().text assert ( str(target_population.total_households_count) == pageTargetingDetails.getLabelTotalNumberOfHouseholds().text @@ -939,7 +950,7 @@ def test_targeting_create_use_ids_individual( self, create_programs: None, household_with_disability: Household, - create_targeting: TargetPopulation, + create_targeting: PaymentPlan, pageTargeting: Targeting, pageTargetingDetails: TargetingDetails, pageTargetingCreate: TargetingCreate, @@ -954,7 +965,7 @@ def test_targeting_create_use_ids_individual( pageTargetingCreate.getInputIndividualids().send_keys("IND-88-0000.0002") pageTargetingCreate.getInputName().send_keys("Target Population for IND-88-0000.0002") pageTargetingCreate.clickButtonTargetPopulationCreate() - target_population = TargetPopulation.objects.get(name="Target Population for IND-88-0000.0002") + target_population = PaymentPlan.objects.get(name="Target Population for IND-88-0000.0002") assert ( "4" == str(target_population.total_individuals_count) @@ -970,7 +981,7 @@ def test_targeting_create_use_ids_individual( def test_targeting_rebuild( self, create_programs: None, - create_targeting: TargetPopulation, + create_targeting: PaymentPlan, pageTargeting: Targeting, pageTargetingDetails: TargetingDetails, pageTargetingCreate: TargetingCreate, @@ -987,7 +998,7 @@ def test_targeting_mark_ready( self, create_programs: None, household_with_disability: Household, - create_targeting: TargetPopulation, + create_targeting: PaymentPlan, pageTargeting: Targeting, filters: Filters, pageTargetingDetails: TargetingDetails, @@ -1009,7 +1020,7 @@ def test_targeting_mark_ready( def test_copy_targeting( self, create_programs: None, - create_targeting: TargetPopulation, + create_targeting: PaymentPlan, pageTargeting: Targeting, pageTargetingDetails: TargetingDetails, pageTargetingCreate: TargetingCreate, @@ -1035,7 +1046,7 @@ def test_edit_targeting( self, create_programs: None, household_with_disability: Household, - create_targeting: TargetPopulation, + create_targeting: PaymentPlan, pageTargeting: Targeting, pageTargetingDetails: TargetingDetails, pageTargetingCreate: TargetingCreate, @@ -1062,11 +1073,15 @@ def test_delete_targeting( self, create_programs: None, household_with_disability: Household, - create_targeting: TargetPopulation, + create_targeting: PaymentPlan, pageTargeting: Targeting, pageTargetingDetails: TargetingDetails, ) -> None: - TargetPopulationFactory(program=Program.objects.get(name="Test Programm"), name="Copy TP") + PaymentPlanFactory( + program_cycle=ProgramCycle.objects.get(program__name="Test Programm"), + name="Copy TP", + status=PaymentPlan.Status.TP_OPEN, + ) pageTargeting.selectGlobalProgramFilter("Test Programm") pageTargeting.getNavTargeting().click() pageTargeting.disappearLoadingRows() @@ -1125,7 +1140,7 @@ def test_exclude_households_with_active_adjudication_ticket( test_data: dict, create_programs: None, household_with_disability: Household, - create_targeting: TargetPopulation, + create_targeting: PaymentPlan, pageTargeting: Targeting, pageTargetingDetails: TargetingDetails, pageTargetingCreate: TargetingCreate, @@ -1196,7 +1211,7 @@ def test_exclude_households_with_sanction_screen_flag( test_data: dict, create_programs: None, household_with_disability: Household, - create_targeting: TargetPopulation, + create_targeting: PaymentPlan, pageTargeting: Targeting, pageTargetingDetails: TargetingDetails, pageTargetingCreate: TargetingCreate, @@ -1242,14 +1257,14 @@ def test_targeting_filters( self, create_programs: None, household_with_disability: Household, - create_targeting: TargetPopulation, + create_targeting: PaymentPlan, pageTargeting: Targeting, filters: Filters, ) -> None: - TargetPopulationFactory( - program=Program.objects.get(name="Test Programm"), + PaymentPlanFactory( + program_cycle=ProgramCycle.objects.get(program__name="Test Programm"), name="Copy TP", - status=TargetPopulation.STATUS_PROCESSING, + status=PaymentPlan.Status.TP_PROCESSING, ) pageTargeting.selectGlobalProgramFilter("Test Programm") pageTargeting.getNavTargeting().click() @@ -1278,13 +1293,13 @@ def test_targeting_and_labels( self, create_programs: None, household_with_disability: Household, - create_targeting: TargetPopulation, + create_targeting: PaymentPlan, pageTargeting: Targeting, ) -> None: - TargetPopulationFactory( - program=Program.objects.get(name="Test Programm"), + PaymentPlanFactory( + program_cycle=ProgramCycle.objects.get(program__name="Test Programm"), name="Copy TP", - status=TargetPopulation.STATUS_PROCESSING, + status=PaymentPlan.Status.TP_PROCESSING, ) pageTargeting.selectGlobalProgramFilter("Test Programm") @@ -1324,7 +1339,7 @@ def test_targeting_parametrized_rules_filters( self, create_programs: None, household_with_disability: Household, - create_targeting: TargetPopulation, + create_targeting: PaymentPlan, pageTargeting: Targeting, pageTargetingDetails: TargetingDetails, pageTargetingCreate: TargetingCreate, @@ -1353,7 +1368,7 @@ def test_targeting_parametrized_rules_filters_and_or( self, create_programs: None, household_with_disability: Household, - create_targeting: TargetPopulation, + create_targeting: PaymentPlan, pageTargeting: Targeting, pageTargetingDetails: TargetingDetails, pageTargetingCreate: TargetingCreate,