From 0be867df6f2e3459d535e6005403e777d1cc8e6d Mon Sep 17 00:00:00 2001 From: Arun Siluvery Date: Wed, 11 Dec 2024 16:39:26 +0000 Subject: [PATCH] Update destinations bdd test to have multiple end_users --- api/data_workspace/v2/tests/bdd/conftest.py | 15 +++++++++++++++ .../v2/tests/bdd/scenarios/destinations.feature | 2 ++ 2 files changed, 17 insertions(+) diff --git a/api/data_workspace/v2/tests/bdd/conftest.py b/api/data_workspace/v2/tests/bdd/conftest.py index 4bf5c3e915..2e2c8f9c4e 100644 --- a/api/data_workspace/v2/tests/bdd/conftest.py +++ b/api/data_workspace/v2/tests/bdd/conftest.py @@ -24,6 +24,7 @@ from api.applications.tests.factories import ( DraftStandardApplicationFactory, GoodOnApplicationFactory, + EndUserFactory, PartyOnApplicationFactory, StandardApplicationFactory, ) @@ -440,6 +441,20 @@ def add_end_user_to_application(draft_standard_application, country): end_user.party.save() +@given(parsers.parse("a new end-user added to the application of `{country}`")) +def add_new_end_user_to_application(draft_standard_application, country): + country = Country.objects.get(name=country) + end_user = PartyOnApplicationFactory( + application=draft_standard_application, + party=EndUserFactory(country=country, organisation=draft_standard_application.organisation), + ) + PartyDocumentFactory( + party=end_user.party, + s3_key="party-document-second", + safe=True, + ) + + @when( "the application is submitted", target_fixture="submitted_standard_application", diff --git a/api/data_workspace/v2/tests/bdd/scenarios/destinations.feature b/api/data_workspace/v2/tests/bdd/scenarios/destinations.feature index b20ec219f3..f8bf4e0773 100644 --- a/api/data_workspace/v2/tests/bdd/scenarios/destinations.feature +++ b/api/data_workspace/v2/tests/bdd/scenarios/destinations.feature @@ -13,10 +13,12 @@ Scenario: Check that the country code and type are included in the extract | id | 03fb08eb-1564-4b68-9336-3ca8906543f9 | And a consignee added to the application in `Australia` And an end-user added to the application of `New Zealand` + And a new end-user added to the application of `South Korea` When the application is submitted And the application is issued at 2024-11-22T13:35:15 Then the `destinations` table has the following rows: | application_id | country_code | type | + | 03fb08eb-1564-4b68-9336-3ca8906543f9 | KR | end_user | | 03fb08eb-1564-4b68-9336-3ca8906543f9 | NZ | end_user | | 03fb08eb-1564-4b68-9336-3ca8906543f9 | AU | consignee |