Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UAT release #2326

Merged
merged 34 commits into from
Dec 3, 2024
Merged
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
09e4651
Add endpoint for goods descriptions
kevincarrogan Nov 25, 2024
f7082be
Add an assessments table
kevincarrogan Nov 11, 2024
cbc2fd1
Add bdd tests for goods ratings endpoint
saruniitr Nov 25, 2024
f16a45d
Merge branch 'dev' into LTD-5673-goods-ratings-endpoint
saruniitr Nov 26, 2024
4a0fe69
Merge branch 'dev' into LTD-5673-goods-ratings-endpoint
saruniitr Nov 26, 2024
e8492c8
Add footnotes table
kevincarrogan Nov 18, 2024
26ade23
Add bdd tests for footnotes endpoint
saruniitr Nov 27, 2024
288b355
Add unit viewset
kevincarrogan Nov 19, 2024
574744b
Add proper 404 for unfound unit
kevincarrogan Nov 19, 2024
923291e
Add bdd tests for units endpoint
saruniitr Nov 27, 2024
78f96e3
Order goods_rating table by the rating
saruniitr Nov 28, 2024
78f88f3
Merge branch 'dev' into LTD-5673-goods-ratings-endpoint
saruniitr Nov 28, 2024
fb4ef21
Add goods on licences endpoint initial commit
hnryjmes Nov 25, 2024
47924e0
Add table_name
hnryjmes Nov 25, 2024
2170459
Add test for issuing a licence
hnryjmes Nov 26, 2024
cb1c1e2
Add test for NLR goods not appearing in goods on licences table
hnryjmes Nov 28, 2024
807d0a0
Add test for draft licences and draft applications
hnryjmes Nov 28, 2024
415390d
Update units endpoint to return the response similar to other endpoints
saruniitr Nov 28, 2024
5d9e50e
Remove unused imports
saruniitr Nov 29, 2024
63c3b5a
Merge pull request #2307 from uktrade/LTD-5674_Productionise_goods_on…
hnryjmes Nov 29, 2024
666e139
Merge branch 'dev' into LTD-5673-goods-ratings-endpoint
saruniitr Nov 29, 2024
6a2824f
Merge pull request #2311 from uktrade/LTD-5673-goods-ratings-endpoint
saruniitr Nov 29, 2024
b59e46f
Merge branch 'dev' into LTD-5688-productionise-footnotes-endpoint
saruniitr Nov 29, 2024
3c0e805
Merge pull request #2318 from uktrade/LTD-5688-productionise-footnote…
saruniitr Nov 29, 2024
a76bd0c
Merge branch 'dev' into LTD-productionise-units-endpoint
saruniitr Nov 29, 2024
96f21b6
Merge pull request #2319 from uktrade/LTD-productionise-units-endpoint
saruniitr Nov 29, 2024
f80613b
Add denial reasons to licence decision
kevincarrogan Nov 25, 2024
d952e00
Stop passing through request to case model in finalise
kevincarrogan Nov 25, 2024
9b4a537
Remove merge migration
kevincarrogan Nov 28, 2024
a6e2788
Merge pull request #2308 from uktrade/LTD-5682-attach-refusal-reasons…
kevincarrogan Nov 29, 2024
18ec33a
Add licence refusal criteria endpoint
kevincarrogan Nov 25, 2024
b5224e1
fixup
kevincarrogan Dec 2, 2024
fabe60d
fixup
kevincarrogan Dec 2, 2024
8accc65
Merge pull request #2310 from uktrade/LTD-5680-productionise-licence-…
kevincarrogan Dec 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add test for NLR goods not appearing in goods on licences table
hnryjmes committed Nov 28, 2024
commit cb1c1e2fcf3ff4285ca2dd6923c1cd6f622ef914
3 changes: 3 additions & 0 deletions api/data_workspace/v2/tests/bdd/conftest.py
Original file line number Diff line number Diff line change
@@ -393,6 +393,9 @@ def _issue_licence(application):
good_on_app.save()
data[f"quantity-{good_on_app.id}"] = str(good_on_app.quantity)
data[f"value-{good_on_app.id}"] = str(good_on_app.value)
# create final advice for controlled goods; skip NLR goods
if good_on_app.is_good_controlled == False:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if good_on_app.is_good_controlled == False:
if good_on_app.is_good_controlled is False:

False is a singleton data type, so should be compared using is. More.

continue
FinalAdviceFactory(user=lu_case_officer, case=application, good=good_on_app.good)

issue_date = datetime.datetime.now()
Original file line number Diff line number Diff line change
@@ -12,3 +12,20 @@ Scenario: Issue a licence
Then the `goods_on_licences` table has the following rows:
| good_id | licence_id |
| 61d193bd-a4d8-4f7d-8c07-1ac5e03ea2c7 | 962b4948-b87a-42fe-9c2b-61bdefd9cd21 |

Scenario: NLR goods not on licence
Given a standard application with the following goods:
| id | name |
| aa9736f9-48f5-4d44-ace9-e4b8738591a5 | Another controlled good |
| 56f562f6-b554-4bb3-923b-8695ab15afca | An NLR good |
And the goods are assessed by TAU as:
| id | Control list entry | Report summary prefix | Report summary subject |
| aa9736f9-48f5-4d44-ace9-e4b8738591a5 | ML5b | accessories for | network analysers |
| 56f562f6-b554-4bb3-923b-8695ab15afca | NLR | | |
And a draft licence with attributes:
| name | value |
| id | 847a9a03-c35f-4036-ab8c-8b58d13482ab |
When the licence is issued
Then the `goods_on_licences` table has the following rows:
| good_id | licence_id |
| aa9736f9-48f5-4d44-ace9-e4b8738591a5 | 847a9a03-c35f-4036-ab8c-8b58d13482ab |
60 changes: 58 additions & 2 deletions api/data_workspace/v2/tests/bdd/test_goods_on_licences.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
from django.urls import reverse
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
from api.staticdata.report_summaries.models import (
ReportSummaryPrefix,
ReportSummarySubject,
)

scenarios("./scenarios/goods_on_licences.feature")

@@ -31,5 +36,56 @@ def draft_licence_with_attributes(parse_attributes, attributes, standard_applica
@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
standard_application.refresh_from_db()
return standard_application


@given(parsers.parse("the goods are assessed by TAU as:{assessments}"))
def the_goods_are_assessed_by_tau_as(
parse_table,
standard_application,
assessments,
api_client,
lu_case_officer,
gov_headers,
):
assessments = parse_table(assessments)[1:]
url = reverse("assessments:make_assessments", kwargs={"case_pk": standard_application.pk})

assessment_payload = []
for good_on_application_id, control_list_entry, report_summary_prefix, report_summary_subject in assessments:
data = {
"id": good_on_application_id,
"comment": "Some comment",
}

if control_list_entry == "NLR":
data.update(
{
"control_list_entries": [],
"is_good_controlled": False,
}
)
else:
if report_summary_prefix:
prefix = ReportSummaryPrefix.objects.get(name=report_summary_prefix)
else:
prefix = None
subject = ReportSummarySubject.objects.get(name=report_summary_subject)
data.update(
{
"control_list_entries": [control_list_entry],
"report_summary_prefix": prefix.pk if prefix else None,
"report_summary_subject": subject.pk,
"is_good_controlled": True,
"regime_entries": [],
}
)
assessment_payload.append(data)

response = api_client.put(
url,
assessment_payload,
**gov_headers,
)
assert response.status_code == 200, response.content