-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into snyk-upgrade-4e8d91ad8439e2729bd2d5f46abc…
…3c63
- Loading branch information
Showing
21 changed files
with
438 additions
and
242 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
migrations/sql/V2024.02.28.11.00__update_mine_report_submission_status.sql
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,22 @@ | ||
INSERT INTO | ||
mine_report_submission_status_code ( | ||
mine_report_submission_status_code, | ||
description, | ||
display_order, | ||
active_ind, | ||
create_user, | ||
create_timestamp, | ||
update_user, | ||
update_timestamp | ||
) | ||
VALUES | ||
( | ||
'WTD', | ||
'Withdrawn', | ||
'50', | ||
True, | ||
'system-mds', | ||
current_timestamp, | ||
'system-mds', | ||
current_timestamp | ||
); |
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
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 |
---|---|---|
|
@@ -8,10 +8,11 @@ | |
|
||
from tests.factories import MineFactory, MineDocumentFactory, MineReportFactory | ||
|
||
|
||
# GET | ||
def test_get_all_mine_report_submissions_for_report(test_client, db_session, auth_headers): | ||
mine_report = MineReportFactory() | ||
|
||
params = f'?mine_report_guid={mine_report.mine_report_guid}' | ||
get_resp = test_client.get( | ||
f'mines/reports/submissions{params}', headers=auth_headers['full_auth_header']) | ||
|
@@ -21,6 +22,7 @@ def test_get_all_mine_report_submissions_for_report(test_client, db_session, aut | |
assert str(mine_report.mine_report_guid) == get_data[0]['mine_report_guid'] | ||
assert get_resp.status_code == 200 | ||
|
||
|
||
def test_get_mine_report_with_no_submissions(test_client, db_session, auth_headers): | ||
mine_report = MineReportFactory(mine_report_submissions=0) | ||
|
||
|
@@ -32,12 +34,13 @@ def test_get_mine_report_with_no_submissions(test_client, db_session, auth_heade | |
assert get_resp.status_code == 200 | ||
assert get_data['mine_report_guid'] == str(mine_report.mine_report_guid) | ||
assert get_data['mine_report_submission_status_code'] == "NON" | ||
assert get_data['mine_report_submission_guid'] == None | ||
assert get_data['documents'] == None | ||
assert get_data['mine_report_submission_guid'] == None | ||
assert get_data['documents'] == None | ||
|
||
|
||
def test_get_latest_mine_report_submission_for_report(test_client, db_session, auth_headers): | ||
mine_report = MineReportFactory() | ||
|
||
params = f'?latest_submission=true&mine_report_guid={mine_report.mine_report_guid}' | ||
get_resp = test_client.get( | ||
f'mines/reports/submissions{params}', headers=auth_headers['full_auth_header']) | ||
|
@@ -48,14 +51,15 @@ def test_get_latest_mine_report_submission_for_report(test_client, db_session, a | |
|
||
|
||
def test_get_latest_report_submission_without_mine_report_guid(test_client, db_session, auth_headers): | ||
# TODO: in the end this is not desired behaviour, | ||
# this is just a reminder to write a real test when implementing | ||
# TODO: in the end this is not desired behaviour, | ||
# this is just a reminder to write a real test when implementing | ||
params = '?latest_submission=true' | ||
get_resp = test_client.get( | ||
f'mines/reports/submissions{params}', headers=auth_headers['full_auth_header']) | ||
|
||
assert get_resp.status_code == 400 | ||
|
||
|
||
# # POST | ||
def test_post_initial_crr_mine_report_submission(test_client, db_session, auth_headers): | ||
mine = MineFactory(minimal=True) | ||
|
@@ -76,7 +80,7 @@ def test_post_initial_crr_mine_report_submission(test_client, db_session, auth_h | |
'received_date': "2024-02-09", | ||
'submission_year': "2024", | ||
'submitter_email': "[email protected]", | ||
'submitter_name': "Submitter Name", | ||
'submitter_name': "Submitter Name", | ||
} | ||
|
||
# post from Minespace | ||
|
@@ -92,6 +96,7 @@ def test_post_initial_crr_mine_report_submission(test_client, db_session, auth_h | |
assert num_submissions == 1 | ||
assert latest_submission['mine_report_submission_status_code'] == "INI" | ||
|
||
|
||
def test_post_requested_report(test_client, db_session, auth_headers): | ||
mine_report = MineReportFactory(mine_report_submissions=0) | ||
|
||
|
@@ -111,7 +116,7 @@ def test_post_requested_report(test_client, db_session, auth_headers): | |
'received_date': "2024-02-09", | ||
'submission_year': "2024", | ||
'submitter_email': "[email protected]", | ||
'submitter_name': "Submitter Name", | ||
'submitter_name': "Submitter Name", | ||
} | ||
|
||
# post from Minespace | ||
|
@@ -124,6 +129,7 @@ def test_post_requested_report(test_client, db_session, auth_headers): | |
assert post_data['mine_report_submission_guid'] is not None | ||
assert post_data['mine_report_definition_guid'] == str(mine_report_definition.mine_report_definition_guid) | ||
|
||
|
||
def test_post_additional_mine_report_submission(test_client, db_session, auth_headers): | ||
mine_report = MineReportFactory(mine_report_submissions=1) | ||
first_submission = mine_report.mine_report_submissions[0] | ||
|
@@ -159,7 +165,7 @@ def test_post_additional_mine_report_submission(test_client, db_session, auth_he | |
if x.mine_report_submission_status_code != first_submission.mine_report_submission_status_code | ||
][0] | ||
submission_data['mine_report_submission_status_code'] = new_status_code.mine_report_submission_status_code | ||
|
||
submission_data['description_comment'] = "New description comment" | ||
|
||
post_resp = test_client.post( | ||
|
@@ -177,10 +183,10 @@ def test_post_additional_mine_report_submission(test_client, db_session, auth_he | |
# fields that should be changed | ||
assert previous_submission['update_timestamp'] != latest_submission['update_timestamp'] | ||
assert previous_submission['submission_date'] != latest_submission['submission_date'] | ||
assert previous_submission['mine_report_submission_status_code'] != latest_submission['mine_report_submission_status_code'] | ||
assert previous_submission['mine_report_submission_status_code'] != latest_submission[ | ||
'mine_report_submission_status_code'] | ||
assert previous_submission['description_comment'] != latest_submission['description_comment'] | ||
|
||
# fields that should not change | ||
assert previous_submission['received_date'] == latest_submission['received_date'] | ||
assert previous_submission['received_date'] == latest_submission['received_date'] | ||
assert previous_submission['create_timestamp'] + '+00:00' == latest_submission['create_timestamp'] | ||
|
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 |
---|---|---|
|
@@ -16,4 +16,4 @@ | |
"express-static-gzip": "2.1.7", | ||
"helmet": "7.1.0" | ||
} | ||
} | ||
} |
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
Oops, something went wrong.