-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
120 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
api/data_workspace/v2/tests/bdd/scenarios/goods_on_licences.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
@db | ||
Feature: Goods On Licences | ||
|
||
Scenario: Issue a licence | ||
Given a standard application with the following goods: | ||
| id | name | | ||
| 61d193bd-a4d8-4f7d-8c07-1ac5e03ea2c7 | A controlled good | | ||
And a draft licence with attributes: | ||
| name | value | | ||
| id | 962b4948-b87a-42fe-9c2b-61bdefd9cd21 | | ||
When the licence is issued | ||
Then the `goods_on_licences` table has the following rows: | ||
| good_id | licence_id | | ||
| 61d193bd-a4d8-4f7d-8c07-1ac5e03ea2c7 | 962b4948-b87a-42fe-9c2b-61bdefd9cd21 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from pytest_bdd import given, parsers, scenarios, when | ||
|
||
from api.applications.tests.factories import GoodOnApplicationFactory | ||
from api.licences.tests.factories import StandardLicenceFactory | ||
from api.licences.enums import LicenceStatus | ||
|
||
scenarios("./scenarios/goods_on_licences.feature") | ||
|
||
|
||
@given(parsers.parse("a standard application with the following goods:{goods}"), target_fixture="standard_application") | ||
def standard_application_with_following_goods(parse_table, goods, standard_application): | ||
standard_application.goods.all().delete() | ||
good_attributes = parse_table(goods)[1:] | ||
for id, name in good_attributes: | ||
GoodOnApplicationFactory( | ||
application=standard_application, | ||
id=id, | ||
good__name=name, | ||
) | ||
return standard_application | ||
|
||
|
||
@given(parsers.parse("a draft licence with attributes:{attributes}"), target_fixture="draft_licence") | ||
def draft_licence_with_attributes(parse_attributes, attributes, standard_application): | ||
draft_licence = StandardLicenceFactory( | ||
case=standard_application, status=LicenceStatus.DRAFT, **parse_attributes(attributes) | ||
) | ||
return draft_licence | ||
|
||
|
||
@when("the licence is issued") | ||
def licence_is_issued(standard_application, issue_licence): | ||
issue_licence(standard_application) | ||
issued_application = standard_application.refresh_from_db() | ||
return issued_application |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule lite_routing
updated
from fbad92 to 514fdb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters