-
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 pull request #2270 from uktrade/dev
UAT Release
- Loading branch information
Showing
17 changed files
with
317 additions
and
226 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
27 changes: 0 additions & 27 deletions
27
api/staticdata/management/commands/seedcontrollistentries.py
This file was deleted.
Oops, something went wrong.
26 changes: 26 additions & 0 deletions
26
api/staticdata/report_summaries/migrations/0009_add_ars_subject_prefix_oct_2024.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,26 @@ | ||
import json | ||
|
||
from django.db import migrations | ||
|
||
DATA_PATH = "api/staticdata/report_summaries/migrations/data/0009_add_report_summaries_oct_2024/" | ||
|
||
|
||
def populate_report_summaries(apps, schema_editor): | ||
|
||
ReportSummaryPrefix = apps.get_model("report_summaries", "ReportSummaryPrefix") | ||
with open(f"{DATA_PATH}/report_summary_prefix.json") as json_file: | ||
records = json.load(json_file) | ||
for attributes in records: | ||
ReportSummaryPrefix.objects.create(**attributes) | ||
|
||
ReportSummarySubject = apps.get_model("report_summaries", "ReportSummarySubject") | ||
with open(f"{DATA_PATH}/report_summary_subject.json") as json_file: | ||
records = json.load(json_file) | ||
for attributes in records: | ||
ReportSummarySubject.objects.create(**attributes) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [("report_summaries", "0008_back_populate_multiple_ars_data")] | ||
|
||
operations = [migrations.RunPython(populate_report_summaries, migrations.RunPython.noop)] |
6 changes: 6 additions & 0 deletions
6
...t_summaries/migrations/data/0009_add_report_summaries_oct_2024/report_summary_prefix.json
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,6 @@ | ||
[ | ||
{ | ||
"id": "d9d1b5fe-71ad-4124-a4a0-2e1bb43fdfaa", | ||
"name": "devices containing" | ||
} | ||
] |
27 changes: 27 additions & 0 deletions
27
..._summaries/migrations/data/0009_add_report_summaries_oct_2024/report_summary_subject.json
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,27 @@ | ||
[ | ||
{ | ||
"id": "9ab0a713-2218-461c-a33f-b60d20a9bf82", | ||
"name": "cryogenic integrated circuits", | ||
"code_level": 1 | ||
}, | ||
{ | ||
"id": "f8125cad-471b-42a1-a28a-b229bdc904de", | ||
"name": "quantum computers", | ||
"code_level": 1 | ||
}, | ||
{ | ||
"id": "41841900-bc0a-438c-b1a7-0728cc73e0cb", | ||
"name": "high performance integrated circuits", | ||
"code_level": 1 | ||
}, | ||
{ | ||
"id": "8d392a69-ec45-4631-bbf2-534bf3a881fe", | ||
"name": "additive manufacturing equipment", | ||
"code_level": 1 | ||
}, | ||
{ | ||
"id": "8438cb42-c791-4463-9bb2-aca0f301e207", | ||
"name": "biological systems", | ||
"code_level": 1 | ||
} | ||
] |
Empty file.
39 changes: 39 additions & 0 deletions
39
...staticdata/report_summaries/migrations/tests/test_0009_add_ars_subject_prefix_oct_2024.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 json | ||
import pytest | ||
|
||
FIXTURE_BASE = "api/staticdata/report_summaries/migrations/data/0009_add_report_summaries_oct_2024/" | ||
INITIAL_MIGRATION = "0008_back_populate_multiple_ars_data" | ||
MIGRATION_UNDER_TEST = "0009_add_ars_subject_prefix_oct_2024" | ||
|
||
|
||
@pytest.mark.django_db() | ||
def test_add_cles(migrator): | ||
with open(FIXTURE_BASE + "report_summary_prefix.json") as prefix_json_file: | ||
report_summary_prefix_data = json.load(prefix_json_file) | ||
|
||
with open(FIXTURE_BASE + "report_summary_subject.json") as subject_json_file: | ||
report_summary_subject_data = json.load(subject_json_file) | ||
|
||
old_state = migrator.apply_initial_migration(("report_summaries", INITIAL_MIGRATION)) | ||
ReportSummaryPrefix = old_state.apps.get_model("report_summaries", "ReportSummaryPrefix") | ||
ReportSummarySubject = old_state.apps.get_model("report_summaries", "ReportSummarySubject") | ||
|
||
for prefix_to_add in report_summary_prefix_data: | ||
assert not ReportSummaryPrefix.objects.filter(name=prefix_to_add["name"]).exists() | ||
|
||
for subject_to_add in report_summary_subject_data: | ||
assert not ReportSummarySubject.objects.filter(name=subject_to_add["name"]).exists() | ||
|
||
new_state = migrator.apply_tested_migration(("report_summaries", MIGRATION_UNDER_TEST)) | ||
|
||
ReportSummaryPrefix = new_state.apps.get_model("report_summaries", "ReportSummaryPrefix") | ||
ReportSummarySubject = new_state.apps.get_model("report_summaries", "ReportSummarySubject") | ||
|
||
for expected_prefix in report_summary_prefix_data: | ||
prefix = ReportSummaryPrefix.objects.get(name=expected_prefix["name"]) | ||
assert str(prefix.id) == expected_prefix["id"] | ||
|
||
for expected_subject in report_summary_subject_data: | ||
subject = ReportSummarySubject.objects.get(name=expected_subject["name"]) | ||
assert str(subject.id) == expected_subject["id"] | ||
assert subject.code_level == expected_subject["code_level"] |
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
Oops, something went wrong.