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

Merged
merged 35 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
8192922
aws region varible addition and added a few other missing variables
markj0hnst0n Apr 11, 2024
1d75be5
minor readme amendments
markj0hnst0n Apr 11, 2024
ce43397
removed unecessary information
markj0hnst0n Apr 12, 2024
96ec6a7
Merge branch 'dev' into setup-changes
markj0hnst0n Apr 12, 2024
1b2f4a4
changed typo on both file to reflect 'bill of lading'
markj0hnst0n Apr 12, 2024
a2d3d73
re-submitting changes
markj0hnst0n Apr 12, 2024
afb0ea4
form link added
markj0hnst0n Apr 15, 2024
eba7386
amended urls.py and tests
markj0hnst0n Apr 15, 2024
1fc4303
govuk-link class added
markj0hnst0n Apr 15, 2024
809ff22
url pattern changed
markj0hnst0n Apr 15, 2024
e0dd5ab
Update urls.py
markj0hnst0n Apr 15, 2024
565521b
Update build_caseworker script to build desnz js file
hnryjmes Apr 15, 2024
19edbf5
Update watch_caseworker script to watch desnz file
hnryjmes Apr 15, 2024
6744fa4
Merge pull request #1893 from uktrade/LTD-4925_Update_build_caseworke…
hnryjmes Apr 15, 2024
6407e02
Merge branch 'dev' into LTS-4892-In-product-section-on-exporter-side-…
markj0hnst0n Apr 15, 2024
91bb10e
Merge branch 'dev' into LTD-4841-add-request-for-people-with-accessib…
markj0hnst0n Apr 15, 2024
d027e5a
Merge branch 'dev' into LTD-4923-rename-url-path-for-denials-upload
markj0hnst0n Apr 15, 2024
d1a1c0f
todo comments added
markj0hnst0n Apr 15, 2024
55d101e
Merge branch 'dev' into LTD-4847-Typo-on-'bill-of-lading'-question-page
markj0hnst0n Apr 15, 2024
c5e8315
Merge pull request #1892 from uktrade/LTD-4923-rename-url-path-for-de…
markj0hnst0n Apr 15, 2024
a21272a
Merge branch 'dev' into LTS-4892-In-product-section-on-exporter-side-…
markj0hnst0n Apr 15, 2024
3800b43
Merge branch 'dev' into LTD-4841-add-request-for-people-with-accessib…
markj0hnst0n Apr 15, 2024
747c515
Merge branch 'dev' into setup-changes
markj0hnst0n Apr 15, 2024
8b3fb88
Merge pull request #1881 from uktrade/setup-changes
markj0hnst0n Apr 15, 2024
b55cc10
Merge branch 'dev' into LTD-4847-Typo-on-'bill-of-lading'-question-page
markj0hnst0n Apr 15, 2024
bd5d9a2
Merge pull request #1887 from uktrade/LTD-4847-Typo-on-'bill-of-ladin…
markj0hnst0n Apr 15, 2024
e3a3358
Expose Closed case status to users
saruniitr Apr 15, 2024
187a97b
Merge branch 'dev' into LTD-4886-Expose-closed-status-LU
saruniitr Apr 15, 2024
5079cd3
Merge branch 'dev' into LTD-4841-add-request-for-people-with-accessib…
markj0hnst0n Apr 16, 2024
1c71a69
Merge branch 'dev' into LTS-4892-In-product-section-on-exporter-side-…
markj0hnst0n Apr 16, 2024
6116131
Merge pull request #1890 from uktrade/LTS-4892-In-product-section-on-…
markj0hnst0n Apr 16, 2024
9600a88
Merge branch 'dev' into LTD-4841-add-request-for-people-with-accessib…
markj0hnst0n Apr 16, 2024
6a48906
Merge pull request #1888 from uktrade/LTD-4841-add-request-for-people…
markj0hnst0n Apr 16, 2024
d6ad335
Merge branch 'dev' into LTD-4886-Expose-closed-status-LU
saruniitr Apr 16, 2024
a2cb90d
Merge pull request #1895 from uktrade/LTD-4886-Expose-closed-status-LU
saruniitr Apr 16, 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
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

- [Python 3.9](https://www.python.org/downloads/release/python-39/)
- [Pipenv](https://pipenv.pypa.io/en/latest/)
- [Homebrew](https://brew.sh/)

### Installing

Expand Down Expand Up @@ -62,15 +63,21 @@ make run_exporter
- Set up your local config file:
- `make secrets`
- populate the newly created `caseworker.env` and `exporter.env` with values from Vault.
- As it states in the env file add the following to your to your /etc/hosts file:
```
127.0.0.1 caseworker
127.0.0.1 exporter
```
- Further information at https://kinsta.com/knowledgebase/edit-mac-hosts-file/

* Ensure docker is running

* Build and start docker images:
- If you haven't already done this for lite-api, set up a shared docker network:
- `docker network create lite` - shared network to allow API and frontend to communicate
- `docker network create lite` - shared network to allow API and frontend to communicate
- `docker-compose build` - build the container image
* Installation requirements
- install libmagic
- install libmagic with the `brew install libmagic` command.

#### Starting the service

Expand Down
1 change: 0 additions & 1 deletion caseworker/core/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ def get_permissible_statuses(request, case):
if status["key"]
not in [
CaseStatusEnum.APPLICANT_EDITING,
CaseStatusEnum.CLOSED,
CaseStatusEnum.FINALISED,
CaseStatusEnum.REGISTERED,
CaseStatusEnum.CLC,
Expand Down
4 changes: 3 additions & 1 deletion caseworker/external_data/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
app_name = "external_data"

urlpatterns = [
path("denials/upload/", views.DenialUploadView.as_view(), name="denials-upload"),
path(
"denials/add-by-csv/", views.DenialUploadView.as_view(), name="denials-add-by-csv"
), # TODO: rename back to "denials/upload/" and "denials-upload" when we are ready to release this to users
path("denials/<uuid:pk>/", views.DenialDetailView.as_view(), name="denial-detail"),
path("denials/<uuid:pk>/revoke/", views.DenialRevokeView.as_view(), name="denial-revoke"),
]
4 changes: 2 additions & 2 deletions example.caseworker.env
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ ALLOWED_HOSTS=*
ALLOWED_HOSTS=*
OAUTHLIB_INSECURE_TRANSPORT=True
GTM_ID=''
LITE_API_HAWK_KEY=

LITE_API_URL=http://host.docker.internal:8100
# comment above LITE_API_URL and uncomment below if running outside docker
Expand All @@ -27,12 +26,14 @@ TEST_TYPE_HEADLESS=False
TEST_SSO_EMAIL=<<FROM_VAULT>>
TEST_SSO_PASSWORD=<<FROM_VAULT>>
TEST_SSO_NAME=<<FROM_VAULT>>
TEST_EXPORTER_SSO_NAME=<<FROM_VAULT>>
EXPORTER_TEST_SSO_EMAIL=<<FROM_VAULT>>
EXPORTER_TEST_SSO_PASSWORD=<<FROM_VAULT>>

# AWS
AWS_S3_ENDPOINT_URL=http://s3:9000
AWS_ACCESS_KEY_ID=minio_username
AWS_REGION=eu-west-2
AWS_SECRET_ACCESS_KEY=minio_password
AWS_STORAGE_BUCKET_NAME=uploads

Expand All @@ -42,7 +43,6 @@ DJANGO_SECRET_KEY=DJANGO_SECRET_KEY

ENVIRONMENT=local

LITE_E2E_HAWK_KEY=LITE_E2E_HAWK_KEY
PERMISSIONS_FINDER_URL=

STATICFILES_STORAGE=django.contrib.staticfiles.storage.StaticFilesStorage
Expand Down
2 changes: 1 addition & 1 deletion exporter/applications/forms/export_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def route_of_goods_form():
"<br>"
+ "<details class='govuk-details' data-module='govuk-details'>"
+ "<summary class='govuk-details__summary'>"
+ "<span class='govuk-details__summary-text'>Help with airway bill and bill of landing</span>"
+ "<span class='govuk-details__summary-text'>Help with airway bill and bill of lading</span>"
+ "</summary>"
+ "<div class='govuk-details__text govuk'>"
+ "<p>"
Expand Down
2 changes: 1 addition & 1 deletion exporter/applications/forms/route_of_goods.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def route_of_goods_form(back_link):
"<br>"
+ "<details class='govuk-details' data-module='govuk-details'>"
+ "<summary class='govuk-details__summary'>"
+ "<span class='govuk-details__summary-text'>Help with airway bill and bill of landing</span>"
+ "<span class='govuk-details__summary-text'>Help with airway bill and bill of lading</span>"
+ "</summary>"
+ "<div class='govuk-details__text govuk'>"
+ "<p>"
Expand Down
2 changes: 1 addition & 1 deletion exporter/templates/applications/goods/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ <h1 class="govuk-heading-l">
</div>

<p class="govuk-body">
Where possible, please add items in the same order as they are shown on the end user undertaking document. This will help case officers process applications quickly.
Where possible, please add items in the same order as they are shown on the end-user undertaking <a class="govuk-link" href="https://www.gov.uk/government/publications/end-user-undertaking-euu-form" target=”_blank”>form</a> (opens in new tab). This will help case officers process applications quickly.
</p>

{% if application.status.key in 'applicant_editing,draft' %}
Expand Down
5 changes: 5 additions & 0 deletions exporter/templates/core/hub.html
Original file line number Diff line number Diff line change
Expand Up @@ -260,4 +260,9 @@ <h2 class="govuk-!-margin-top-0">
</div>
</div>
{% endif %}
<div class="govuk-grid-row">
<div class="govuk-body govuk-grid-column-two-thirds govuk-!-margin-top-5">
{% comment %}/PS-IGNORE{% endcomment %}If you or any of your colleagues have accessibility needs, tell us how we can improve your user experience. Contact <a href="mailto:[email protected]">[email protected]</a>.
</div>
</div>
{% endblock %}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"private": true,
"scripts": {
"build_exporter": "parcel build ./exporter/assets/javascripts/main.js ./exporter/assets/javascripts/cookie-policy-form.js --dist-dir exporter/assets/built --public-url /assets/",
"build_caseworker": "parcel build ./caseworker/assets/javascripts/{main,head,bookmarks,cookie-policy-form,beis,tau,tau-edit,tau-multiple-assessment-edit,case-filters,refusal-review-consolidate,search-products}.js --dist-dir caseworker/assets/built --public-url /assets/",
"build_caseworker": "parcel build ./caseworker/assets/javascripts/{main,head,bookmarks,cookie-policy-form,desnz,tau,tau-edit,tau-multiple-assessment-edit,case-filters,refusal-review-consolidate,search-products}.js --dist-dir caseworker/assets/built --public-url /assets/",
"watch_exporter": "PARCEL_WORKERS=0 parcel watch --port 8400 ./exporter/assets/javascripts/{main,head}.js ./exporter/assets/javascripts/cookie-policy-form.js --dist-dir exporter/assets/built --public-url /assets/",
"watch_caseworker": "PARCEL_WORKERS=0 parcel watch --port 8401 ./caseworker/assets/javascripts/{main,head,bookmarks,cookie-policy-form,search-cases,beis,tau,tau-edit,tau-multiple-assessment-edit,case-filters,refusal-review-consolidate,search-products}.js --dist-dir caseworker/assets/built --public-url /assets/",
"watch_caseworker": "PARCEL_WORKERS=0 parcel watch --port 8401 ./caseworker/assets/javascripts/{main,head,bookmarks,cookie-policy-form,search-cases,desnz,tau,tau-edit,tau-multiple-assessment-edit,case-filters,refusal-review-consolidate,search-products}.js --dist-dir caseworker/assets/built --public-url /assets/",
"watch": "rm -rf .parcel-cache && npm run build_exporter && npm run build_caseworker && concurrently 'npm run watch_exporter' 'npm run watch_caseworker'",
"build": "npm install --no-save && npm run build_all",
"build_all": "export NODE_ENV=production && concurrently 'npm run build_exporter' 'npm run build_caseworker'",
Expand Down
36 changes: 36 additions & 0 deletions unit_tests/caseworker/cases/views/test_change_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,42 @@ def test_change_status_GET_provides_finalise_status(
assert (CaseStatusEnum.FINALISED in statuses) == expected


@pytest.mark.parametrize(
"gov_user_type,expected",
[
("mock_gov_tau_user", False),
("mock_gov_fcdo_user", False),
("mock_gov_desnz_nuclear_user", False),
("mock_gov_lu_user", False),
("mock_gov_lu_super_user", True),
],
)
def test_closed_status_visible_to_specific_roles(
authorized_client,
change_status_url,
case_id,
gov_user_type,
expected,
request,
):
_ = request.getfixturevalue(gov_user_type)

response = authorized_client.get(change_status_url)
assert response.status_code == 200

assertTemplateUsed(response, "layouts/case.html")
context = response.context
assert context["case"].id == case_id

html = BeautifulSoup(response.content, "html.parser")
all_h1s = [elem.get_text().strip() for elem in html.find_all("h1")]
assert "Change case status" in all_h1s

# Only LU users get an option set the status as 'Finalised'
statuses = [item["value"] for item in html.find_all("option")]
assert (CaseStatusEnum.CLOSED in statuses) == expected


def test_change_status_success(
authorized_client,
case_url,
Expand Down
17 changes: 16 additions & 1 deletion unit_tests/caseworker/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,22 @@ def mock_gov_lu_user(requests_mock, mock_notifications, mock_case_statuses, mock
requests_mock.get(url=re.compile(f"{url}{gov_uk_user_id}/"), json=mock_gov_user)


@pytest.fixture
def mock_gov_lu_super_user(requests_mock, mock_notifications, mock_case_statuses, mock_gov_user, gov_uk_user_id):
mock_gov_user["user"]["team"] = {
"id": "521154de-f39e-45bf-9922-baaaaaa",
"name": "Licencing Unit",
"alias": "LICENSING_UNIT",
}
mock_gov_user["user"]["role"]["statuses"].extend(
[{"id": "00000000-0000-0000-0000-000000000009", "key": "closed", "value": "Closed", "priority": 16}]
)

url = client._build_absolute_uri("/gov-users/")
requests_mock.get(url=f"{url}me/", json=mock_gov_user)
requests_mock.get(url=re.compile(f"{url}{gov_uk_user_id}/"), json=mock_gov_user)


@pytest.fixture
def mock_notifications(requests_mock):
url = client._build_absolute_uri("/gov-users/notifications/")
Expand Down Expand Up @@ -1605,7 +1621,6 @@ def mock_case_statuses(requests_mock):
"priority": 14,
},
{"id": "00000000-0000-0000-0000-000000000008", "key": "withdrawn", "value": "Withdrawn", "priority": 15},
{"id": "00000000-0000-0000-0000-000000000009", "key": "closed", "value": "Closed", "priority": 16},
{"id": "00000000-0000-0000-0000-000000000010", "key": "registered", "value": "Registered", "priority": 17},
{
"id": "00000000-0000-0000-0000-000000000011",
Expand Down
12 changes: 9 additions & 3 deletions unit_tests/caseworker/external_data/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ def mock_denial_patch(requests_mock):

def test_upload_denial_404(authorized_client, mock_denial_upload, settings):
# given the case has activity from system user
url = reverse("external_data:denials-upload")
url = reverse(
"external_data:denials-add-by-csv"
) # TODO: rename back to ""denials-upload" when we are ready to release this to users

file_path = os.path.join(settings.BASE_DIR, "caseworker/external_data/example.csv")
data = {"csv_file": open(file_path, "rb")}
Expand All @@ -62,7 +64,9 @@ def test_upload_denial_404(authorized_client, mock_denial_upload, settings):
@pytest.mark.skip(reason="CSV denials upload has been disabled")
def test_upload_denial_valid_file(authorized_client, mock_denial_upload, settings):
# given the case has activity from system user
url = reverse("external_data:denials-upload")
url = reverse(
"external_data:denials-add-by-csv"
) # TODO: rename back to ""denials-upload" when we are ready to release this to users

file_path = os.path.join(settings.BASE_DIR, "caseworker/external_data/example.csv")
data = {"csv_file": open(file_path, "rb")}
Expand All @@ -80,7 +84,9 @@ def test_upload_denial_valid_file(authorized_client, mock_denial_upload, setting
@pytest.mark.skip(reason="CSV denials upload has been disabled")
def test_upload_denial_invalid_file(authorized_client, mock_denial_upload_validation_error, settings):
# given the case has activity from system user
url = reverse("external_data:denials-upload")
url = reverse(
"external_data:denials-add-by-csv"
) # TODO: rename back to ""denials-upload" when we are ready to release this to users

file_path = os.path.join(settings.BASE_DIR, "caseworker/external_data/example.csv")
data = {"csv_file": open(file_path, "rb")}
Expand Down