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 #2371

Merged
merged 103 commits into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from 88 commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
282b1dc
add structure and first form in flow
markj0hnst0n Feb 14, 2025
cbfeaf5
first 2 screens added
markj0hnst0n Feb 14, 2025
e198335
add product classification confirmation screen
markj0hnst0n Feb 14, 2025
ecc5136
add extra text and correct button text
markj0hnst0n Feb 14, 2025
c87f320
add foreign tech screen and remove security grading info
markj0hnst0n Feb 17, 2025
9f47029
add ITAR screen and use template for name subtitle
markj0hnst0n Feb 17, 2025
91a489a
add structure and first form in flow
markj0hnst0n Feb 14, 2025
a0e87c4
first 2 screens added
markj0hnst0n Feb 14, 2025
ddc1769
add product classification confirmation screen
markj0hnst0n Feb 14, 2025
f21e5f4
add extra text and correct button text
markj0hnst0n Feb 14, 2025
a5c5d00
add foreign tech screen and remove security grading info
markj0hnst0n Feb 17, 2025
a847b85
add ITAR screen and use template for name subtitle
markj0hnst0n Feb 17, 2025
c5489d8
Merge branch 'LTD-5904' of https://github.com/uktrade/lite-frontend i…
markj0hnst0n Feb 17, 2025
f453efc
tidy
markj0hnst0n Feb 17, 2025
f6d846c
hook up summary page
markj0hnst0n Feb 17, 2025
560cc48
add conditional radio question
markj0hnst0n Feb 17, 2025
a922175
add about itar screen
markj0hnst0n Feb 17, 2025
e795634
add cryptography screen
markj0hnst0n Feb 17, 2025
36ed303
add mctr screen
markj0hnst0n Feb 17, 2025
a59e9d5
add mctr screen
markj0hnst0n Feb 17, 2025
97d6b4e
add manpads screen
markj0hnst0n Feb 17, 2025
d064ed1
add f680 org permissions
depsiatwal Feb 17, 2025
f82cca6
Merge branch 'dev' into LTD-5926-FF-F680-Allowed-orgs
depsiatwal Feb 17, 2025
635ce52
add electronic warfare data screen
markj0hnst0n Feb 17, 2025
58cd3db
rename and add final screens
markj0hnst0n Feb 17, 2025
5172dd7
add choice type and dividers
markj0hnst0n Feb 17, 2025
cf7eb50
lint
markj0hnst0n Feb 17, 2025
2ede906
fix tests
depsiatwal Feb 17, 2025
2d59ef5
Squashed commit of the following:
markj0hnst0n Feb 18, 2025
4515bae
remove name
depsiatwal Feb 12, 2025
0bfd980
remove name view
depsiatwal Feb 12, 2025
0c980e0
Merge pull request #2359 from uktrade/LTD-5911-f680-drop-name
currycoder Feb 18, 2025
5dbeaa0
Improve F680 application JSON contract
currycoder Feb 12, 2025
34aa91b
Add initial user information flow
currycoder Feb 13, 2025
a555593
Flesh out user information flow with non-conditional steps
currycoder Feb 13, 2025
5c57c4f
Make country field in to an autocomplete input
currycoder Feb 13, 2025
840b4cf
Add manufacturer/assemble step to user information flow
currycoder Feb 13, 2025
e892aa8
Add conditional third party role step
currycoder Feb 13, 2025
36aea31
Fix unit test
currycoder Feb 14, 2025
5136483
Relocate common fixtures
currycoder Feb 14, 2025
4ab3fed
Add unit tests for user information item add and edit
currycoder Feb 17, 2025
5dc957a
Add interstitial user information summary sections
currycoder Feb 17, 2025
b39b5eb
Skip the user information summary if no user entities
currycoder Feb 17, 2025
581b1a8
Fix lint complaints
currycoder Feb 17, 2025
94fd54a
Fixup: Fix bad conflict resolution
currycoder Feb 17, 2025
5529872
Make additional information/approval type sections work with new JSON…
currycoder Feb 17, 2025
8076524
Re-sequence F680 application sections in summary template
currycoder Feb 17, 2025
a111658
Switch to F680-specific conditional questions form components
currycoder Feb 17, 2025
90f2f32
Fix approval type tests
currycoder Feb 17, 2025
e06c695
Fix notes for case officers tests
currycoder Feb 17, 2025
a356ee3
Fix test coverage
currycoder Feb 17, 2025
504d81b
allow flag or org list
depsiatwal Feb 18, 2025
39559f9
Merge branch 'dev' into LTD-5926-FF-F680-Allowed-orgs
depsiatwal Feb 18, 2025
9aab465
Squashed commit of the following:
markj0hnst0n Feb 18, 2025
86fb672
Squashed commit of the following:
markj0hnst0n Feb 18, 2025
f9996a4
fix tests
depsiatwal Feb 18, 2025
d78e0f7
Merge branch 'dev' into LTD-5904
markj0hnst0n Feb 18, 2025
c1f193c
fix summary
markj0hnst0n Feb 18, 2025
923a17a
Merge branch 'LTD-5904' of https://github.com/uktrade/lite-frontend i…
markj0hnst0n Feb 18, 2025
8759e13
test setup
markj0hnst0n Feb 18, 2025
4051292
formatting
markj0hnst0n Feb 18, 2025
5acf0fe
add post success tests
markj0hnst0n Feb 18, 2025
720b983
change triage and rules
depsiatwal Feb 18, 2025
7aa5fdb
tests current state
markj0hnst0n Feb 18, 2025
a24f2a4
Revert "tests current state"
markj0hnst0n Feb 18, 2025
173db58
test current state
markj0hnst0n Feb 18, 2025
5b812ee
Demonstrate executing conditional steps
currycoder Feb 18, 2025
f9bb52d
happy path tests working
markj0hnst0n Feb 18, 2025
945b227
post validation tests added
markj0hnst0n Feb 18, 2025
60ca552
add submit success test
markj0hnst0n Feb 18, 2025
1c5c67c
test correct forms display when "False" is given as answer to conditi…
markj0hnst0n Feb 18, 2025
f222130
get initial data tests added
markj0hnst0n Feb 18, 2025
4143c9f
Merge pull request #2357 from uktrade/LTD-5905-f680-user-information-…
currycoder Feb 18, 2025
d098669
Merge branch 'dev' into LTD-5904
markj0hnst0n Feb 18, 2025
8efe836
fix brackets
markj0hnst0n Feb 18, 2025
1c688e3
lint
markj0hnst0n Feb 18, 2025
bbc2b5b
remove unnecessary
markj0hnst0n Feb 19, 2025
f81aa00
fix choice name
markj0hnst0n Feb 19, 2025
71ff167
remove don't know choice
markj0hnst0n Feb 19, 2025
3b93ee8
fix mctr choices and summary page
markj0hnst0n Feb 19, 2025
c8b0059
test fix
markj0hnst0n Feb 19, 2025
7a945c3
move fixture to conftest
markj0hnst0n Feb 19, 2025
0a2ac9e
move tests
depsiatwal Feb 19, 2025
bff8952
Merge branch 'dev' into LTD-5926-FF-F680-Allowed-orgs
depsiatwal Feb 19, 2025
92025a2
Merge pull request #2364 from uktrade/LTD-5904
currycoder Feb 19, 2025
b7027c2
Merge branch 'dev' into LTD-5926-FF-F680-Allowed-orgs
depsiatwal Feb 19, 2025
101904d
fix tests
depsiatwal Feb 19, 2025
487a911
Merge pull request #2365 from uktrade/LTD-5926-FF-F680-Allowed-orgs
depsiatwal Feb 19, 2025
998a780
Add basic F680 application submission
currycoder Feb 17, 2025
7899a93
Display F680 application questions/answers programmatically
currycoder Feb 17, 2025
7b068e3
Redirect to submit success page after submitting F680
currycoder Feb 18, 2025
0b62d84
Validate application sections complete before allowing submit
currycoder Feb 18, 2025
f4260ab
Relocate F680 unit tests
currycoder Feb 18, 2025
3ff6ab0
Add unit tests for F680 submission view
currycoder Feb 18, 2025
48e3d72
Extend F680 case detail unit tests
currycoder Feb 18, 2025
526a002
Fix coverage complaint
currycoder Feb 18, 2025
36e4602
Fix lint complaint
currycoder Feb 18, 2025
709b008
Relocate fixture after conflict resolution
currycoder Feb 19, 2025
d725ed4
Add product information as required section before submission
currycoder Feb 19, 2025
d91abb2
Remove redundant test
currycoder Feb 19, 2025
ee5e8a4
Fix lint complaint
currycoder Feb 24, 2025
47c17fa
Fix lint complaint
currycoder Feb 24, 2025
a759431
Merge pull request #2369 from uktrade/LTD-5908-submit-f680-application
currycoder Feb 24, 2025
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
1 change: 1 addition & 0 deletions conf/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,4 @@

CSP_REPORT_URI = env.tuple("EXPORTER_CSP_REPORT_URI", default=("",))
E2E_WAIT_MULTIPLIER = env.int("E2E_WAIT_MULTIPLIER", default=1)
FEATURE_FLAG_F680_ALLOWED_ORGANISATIONS = env.list("FEATURE_FLAG_F680_ALLOWED_ORGANISATIONS", default=[])
5 changes: 3 additions & 2 deletions exporter/apply_for_a_licence/forms/triage_questions.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import rules
from django.urls import reverse
from django.conf import settings

Expand All @@ -24,7 +25,7 @@
from django.template.loader import render_to_string


def opening_question():
def opening_question(request):
options = [
Option(
key="export_licence",
Expand All @@ -42,7 +43,7 @@ def opening_question():
"governments and individuals. This includes F680 approval. You should apply for security approval"
" before you apply for a licence."
),
disabled=not settings.FEATURE_FLAG_ALLOW_F680,
disabled=not rules.test_rule("can_exporter_use_f680s", request),
),
Option(
key="transhipment",
Expand Down
2 changes: 1 addition & 1 deletion exporter/apply_for_a_licence/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

class LicenceType(LoginRequiredMixin, SingleFormView):
def init(self, request, **kwargs):
self.form = opening_question()
self.form = opening_question(request)
self.action = validate_opening_question

def get_success_url(self):
Expand Down
16 changes: 16 additions & 0 deletions exporter/core/rules.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import rules
from django.conf import settings


@rules.predicate
def can_exporter_use_f680s(request):
return (
request.session["organisation"] in settings.FEATURE_FLAG_F680_ALLOWED_ORGANISATIONS
or settings.FEATURE_FLAG_ALLOW_F680
)


rules.add_rule(
"can_exporter_use_f680s",
can_exporter_use_f680s,
)
29 changes: 29 additions & 0 deletions exporter/core/tests/test_rules.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import pytest
import rules


@pytest.mark.parametrize(
"user_organisation, allowed_organisations_feature, f680_enabled_feature_flag, expected",
(
("12345", ["12345", "98765", "56757"], False, True),
("99999", ["12345", "98765", "56757"], False, False),
("", ["12345", "98765", "56757"], False, False),
("99999", [], False, False),
(None, [], False, False),
("99999", [], True, True),
("99999", ["12345", "98765", "56757"], True, True),
),
)
def test_can_exporter_use_f680s(
rf, client, user_organisation, allowed_organisations_feature, f680_enabled_feature_flag, expected, settings
):
settings.FEATURE_FLAG_F680_ALLOWED_ORGANISATIONS = allowed_organisations_feature
settings.FEATURE_FLAG_ALLOW_F680 = f680_enabled_feature_flag

request = rf.get("/")
request.session = client.session
session = request.session
session["organisation"] = user_organisation
session.save()

assert rules.test_rule("can_exporter_use_f680s", request) is expected
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ def unset_f680_feature_flag(settings):
settings.FEATURE_FLAG_ALLOW_F680 = False


@pytest.fixture()
def set_f680_allowed_organisation(settings, organisation_pk):
settings.FEATURE_FLAG_F680_ALLOWED_ORGANISATIONS = [organisation_pk]
settings.FEATURE_FLAG_ALLOW_F680 = False


@pytest.fixture()
def unset_f680_allowed_organisation(settings, organisation_pk):
settings.FEATURE_FLAG_F680_ALLOWED_ORGANISATIONS = ["12345"]
settings.FEATURE_FLAG_ALLOW_F680 = False


@pytest.fixture(autouse=True)
def setup(mock_exporter_user_me, settings):
settings.FEATURE_FLAG_ALLOW_F680 = True
Expand Down Expand Up @@ -55,7 +67,21 @@ def mock_f680_application_get(requests_mock, data_f680_case):
@pytest.fixture
def mock_f680_application_get_existing_data(requests_mock, data_f680_case):
data_f680_case["application"] = {
"additional_information": {"answers": {"note": "Some note text"}, "questions": {"note": "Add note"}}
"sections": {
"notes_for_case_officers": {
"type": "single",
"label": "Notes for case officers",
"fields": [
{
"key": "note",
"answer": "Some note text",
"datatype": "string",
"question": "Add note",
"raw_answer": "Some note text",
}
],
}
}
}
application_id = data_f680_case["id"]
url = client._build_absolute_uri(f"/exporter/f680/application/{application_id}/")
Expand Down Expand Up @@ -100,6 +126,17 @@ def test_GET_success(
assert response.status_code == 200
assert isinstance(response.context["form"], NotesForCaseOfficerForm)

def test_GET_success_with_organisation_set(
self,
authorized_client,
mock_f680_application_get,
f680_application_wizard_url,
set_f680_allowed_organisation,
):
response = authorized_client.get(f680_application_wizard_url)
assert response.status_code == 200
assert isinstance(response.context["form"], NotesForCaseOfficerForm)

def test_GET_no_feature_flag_forbidden(
self,
authorized_client,
Expand All @@ -111,6 +148,17 @@ def test_GET_no_feature_flag_forbidden(
assert response.status_code == 200
assert response.context["title"] == "Forbidden"

def test_GET_no_feature_organisation_allowed(
self,
authorized_client,
mock_f680_application_get,
f680_application_wizard_url,
unset_f680_allowed_organisation,
):
response = authorized_client.get(f680_application_wizard_url)
assert response.status_code == 200
assert response.context["title"] == "Forbidden"

def test_POST_approval_type_and_submit_wizard_success(
self, post_to_step, goto_step, mock_f680_application_get, mock_patch_f680_application
):
Expand All @@ -123,7 +171,21 @@ def test_POST_approval_type_and_submit_wizard_success(
assert mock_patch_f680_application.last_request.json() == {
"application": {
"name": "F680 Test 1",
"additional_information": {"answers": {"note": "Some information"}, "questions": {"note": "Add note"}},
"sections": {
"notes_for_case_officers": {
"label": "Notes for case officers",
"fields": [
{
"key": "note",
"answer": "Some information",
"raw_answer": "Some information",
"question": "Add note",
"datatype": "string",
}
],
"type": "single",
}
},
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ class NotesForCaseOfficersView(F680ApplicationSectionWizard):
form_list = [
(FormSteps.NOTES_FOR_CASEWORKER, NotesForCaseOfficerForm),
]
section = "additional_information"
section = "notes_for_case_officers"
section_label = "Notes for case officers"
11 changes: 11 additions & 0 deletions exporter/f680/application_sections/approval_details/constants.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
class FormSteps:
APPROVAL_TYPE = "APPROVAL_TYPE"
PRODUCT_NAME = "PRODUCT_NAME"
PRODUCT_DESCRIPTION = "PRODUCT_DESCRIPTION"
PRODUCT_FOREIGN_TECHNOLOGY_OR_INFORMATION_SHARED = "PRODUCT_FOREIGN_TECHNOLOGY_OR_INFORMATION_SHARED"
PRODUCT_CONTROLLED_UNDER_ITAR = "PRODUCT_CONTROLLED_UNDER_ITAR"
PRODUCT_CONTROLLED_UNDER_ITAR_DETAILS = "PRODUCT_CONTROLLED_UNDER_ITAR_DETAILS"
PRODUCT_INCLUDE_CRYPTOGRAPHY = "PRODUCT_INCLUDE_CRYPTOGRAPHY"
PRODUCT_RATED_UNDER_MTCR = "PRODUCT_RATED_UNDER_MTCR"
PRODUCT_MANPAD = "PRODUCT_MANPAD"
PRODUCT_ELECTRONICMODDATA = "PRODUCT_ELECTRONICMODDATA"
PRODUCT_FUNDING = "PRODUCT_FUNDING"
PRODUCT_USED_BY_UK_ARMED_FORCES = "PRODUCT_USED_BY_UK_ARMED_FORCES"
Loading
Loading