From 807d0a0140eca9c5373a564f45c09b94c36f458f Mon Sep 17 00:00:00 2001 From: Henry Cooksley Date: Thu, 28 Nov 2024 19:40:29 +0000 Subject: [PATCH] Add test for draft licences and draft applications --- .../bdd/scenarios/goods_on_licences.feature | 18 ++++++++++++++++++ .../v2/tests/bdd/test_goods_on_licences.py | 15 +++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/api/data_workspace/v2/tests/bdd/scenarios/goods_on_licences.feature b/api/data_workspace/v2/tests/bdd/scenarios/goods_on_licences.feature index ce3c4a9e4..3b67b6cde 100644 --- a/api/data_workspace/v2/tests/bdd/scenarios/goods_on_licences.feature +++ b/api/data_workspace/v2/tests/bdd/scenarios/goods_on_licences.feature @@ -29,3 +29,21 @@ Scenario: NLR goods not on licence Then the `goods_on_licences` table has the following rows: | good_id | licence_id | | aa9736f9-48f5-4d44-ace9-e4b8738591a5 | 847a9a03-c35f-4036-ab8c-8b58d13482ab | + +Scenario: Draft licences + Given a standard application with the following goods: + | id | name | + | f7c674b1-cd5e-4a6d-a1f5-d6ab58149d05 | A controlled good 2 | + And a draft licence with attributes: + | name | value | + | id | 297e89b9-fc93-4f38-be46-c2ab38914007 | + Then the `goods_on_licences` table is empty + +Scenario: Draft applications + Given a draft standard application with the following goods: + | id | name | + | 8262dcf7-d932-4a33-978d-b5aa8a7878ee | A controlled good 3 | + And a draft licence with attributes: + | name | value | + | id | 2078827b-6d67-406c-becc-41c423720cfc | + Then the `goods_on_licences` table is empty diff --git a/api/data_workspace/v2/tests/bdd/test_goods_on_licences.py b/api/data_workspace/v2/tests/bdd/test_goods_on_licences.py index f545efbfd..9c51e66aa 100644 --- a/api/data_workspace/v2/tests/bdd/test_goods_on_licences.py +++ b/api/data_workspace/v2/tests/bdd/test_goods_on_licences.py @@ -89,3 +89,18 @@ def the_goods_are_assessed_by_tau_as( **gov_headers, ) assert response.status_code == 200, response.content + + +@given( + parsers.parse("a draft standard application with the following goods:{goods}"), target_fixture="draft_application" +) +def draft_standard_application_with_following_goods(parse_table, goods, draft_application): + draft_application.goods.all().delete() + good_attributes = parse_table(goods)[1:] + for id, name in good_attributes: + GoodOnApplicationFactory( + application=draft_application, + id=id, + good__name=name, + ) + return draft_application