-
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.
Merge branch 'dev' into LTD-modify-bdd-tests
- Loading branch information
Showing
8 changed files
with
114 additions
and
25 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
28 changes: 28 additions & 0 deletions
28
api/data_workspace/v2/tests/bdd/scenarios/licence_refusal_criteria.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,28 @@ | ||
@db | ||
Feature: licence_refusal_criteria Table | ||
|
||
Scenario: Draft application | ||
Given a draft standard application | ||
Then the `licence_refusal_criteria` table is empty | ||
|
||
Scenario: Submit an application | ||
Given a draft standard application | ||
When the application is submitted | ||
Then the `licence_refusal_criteria` table is empty | ||
|
||
Scenario: Issuing an application | ||
Given a draft standard application | ||
When the application is submitted | ||
And the application is issued | ||
Then the `licence_refusal_criteria` table is empty | ||
|
||
Scenario: Refusing an application | ||
Given a draft standard application | ||
When the application is submitted | ||
And the application is refused with criteria: | ||
| 1 | | ||
| 2c | | ||
Then the `licence_refusal_criteria` table has the following rows: | ||
| licence_decision_id | criteria | | ||
| 03fb08eb-1564-4b68-9336-3ca8906543f9 | 1 | | ||
| 03fb08eb-1564-4b68-9336-3ca8906543f9 | 2c | |
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
39 changes: 39 additions & 0 deletions
39
api/data_workspace/v2/tests/bdd/test_licence_refusal_criteria.py
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,39 @@ | ||
import uuid | ||
|
||
from pytest_bdd import ( | ||
parsers, | ||
scenarios, | ||
when, | ||
) | ||
|
||
|
||
scenarios("./scenarios/licence_refusal_criteria.feature") | ||
|
||
|
||
@when(parsers.parse("the application is refused with criteria:{criteria}")) | ||
def when_the_application_is_refused_with_criteria( | ||
submitted_standard_application, refuse_application, parse_table, criteria | ||
): | ||
criteria = [c[0] for c in parse_table(criteria)] | ||
refuse_application(submitted_standard_application, criteria) | ||
refused_application = submitted_standard_application | ||
licence_decision = refused_application.licence_decisions.get() | ||
old_pk = licence_decision.pk | ||
licence_decision.pk = uuid.UUID("03fb08eb-1564-4b68-9336-3ca8906543f9") # /PS-IGNORE | ||
licence_decision.save() | ||
licence_decision.denial_reasons.through.objects.filter(licencedecision_id=old_pk).update( | ||
licencedecision_id=licence_decision.pk | ||
) | ||
|
||
|
||
@when("the application is issued") | ||
def when_the_application_is_issued( | ||
issue_licence, | ||
submitted_standard_application, | ||
): | ||
issue_licence(submitted_standard_application) | ||
|
||
submitted_standard_application.refresh_from_db() | ||
issued_application = submitted_standard_application | ||
|
||
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
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