-
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 #2208 from uktrade/uat
PROD Release
- Loading branch information
Showing
26 changed files
with
1,035 additions
and
722 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
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
22 changes: 22 additions & 0 deletions
22
api/letter_templates/migrations/0010_refusal_letter_picklist_update_team_ownership.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,22 @@ | ||
from django.db import migrations | ||
|
||
LICENSING_UNIT_TEAM_ID = "58e77e47-42c8-499f-a58d-94f94541f8c6" | ||
|
||
|
||
def refusal_letter_picklist_update_team_ownership(apps, schema_editor): | ||
|
||
PicklistItem = apps.get_model("picklists", "PicklistItem") | ||
refusal_letter_content = PicklistItem.objects.get(name="Refusal letter content") | ||
refusal_letter_content.team_id = LICENSING_UNIT_TEAM_ID | ||
refusal_letter_content.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("letter_templates", "0009_refusal_letter_update_fix"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(refusal_letter_picklist_update_team_ownership, migrations.RunPython.noop), | ||
] |
15 changes: 15 additions & 0 deletions
15
...ter_templates/migrations/tests/test_0010_refusal_letter_picklist_update_team_ownership.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,15 @@ | ||
import pytest | ||
from django_test_migrations.contrib.unittest_case import MigratorTestCase | ||
|
||
|
||
@pytest.mark.django_db() | ||
class TestChangeTeamRefusalPickList(MigratorTestCase): | ||
migrate_from = ("letter_templates", "0009_refusal_letter_update_fix") | ||
migrate_to = ("letter_templates", "0010_refusal_letter_picklist_update_team_ownership") | ||
|
||
def test_refusal_letter_picklist_update_team_ownership(self): | ||
LICENSING_UNIT_TEAM_ID = "58e77e47-42c8-499f-a58d-94f94541f8c6" # /PS-IGNORE | ||
|
||
PicklistItem = self.new_state.apps.get_model("picklists", "PicklistItem") | ||
|
||
assert str(PicklistItem.objects.get(name="Refusal letter content").team_id) == LICENSING_UNIT_TEAM_ID |
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
Empty file.
Empty file.
9 changes: 9 additions & 0 deletions
9
api/staticdata/caseworker/control_list_entries/serializers.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,9 @@ | ||
from rest_framework import serializers | ||
|
||
from api.staticdata.control_list_entries.models import ControlListEntry | ||
|
||
|
||
class ControlListEntriesListSerializer(serializers.ModelSerializer): | ||
class Meta: | ||
model = ControlListEntry | ||
fields = ("rating", "text", "parent") |
Empty file.
67 changes: 67 additions & 0 deletions
67
api/staticdata/caseworker/control_list_entries/tests/test_views.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,67 @@ | ||
from rest_framework import status | ||
from rest_framework.reverse import reverse | ||
|
||
from api.staticdata.control_list_entries.models import ControlListEntry | ||
from api.staticdata.control_list_entries.factories import ControlListEntriesFactory | ||
from test_helpers.clients import DataTestClient | ||
|
||
|
||
class ControlListEntriesListTests(DataTestClient): | ||
def setUp(self): | ||
self.url = reverse("caseworker_staticdata:control_list_entries:control_list_entries") | ||
super().setUp() | ||
ControlListEntry.objects.all().delete() | ||
self.parent_cle = ControlListEntriesFactory( | ||
rating="ML1", | ||
selectable_for_assessment=False, | ||
text="some ML1 text", | ||
) | ||
self.child_cle = ControlListEntriesFactory( | ||
rating="ML1a", | ||
parent=self.parent_cle, | ||
selectable_for_assessment=True, | ||
text="some ML1a text", | ||
) | ||
|
||
def test_GET_success(self): | ||
response = self.client.get(self.url, **self.gov_headers) | ||
|
||
self.assertEqual(response.status_code, status.HTTP_200_OK) | ||
|
||
self.assertEqual( | ||
response.json(), | ||
[ | ||
{ | ||
"rating": "ML1a", | ||
"text": "some ML1a text", | ||
"parent": str(self.parent_cle.id), | ||
} | ||
], | ||
) | ||
|
||
def test_GET_exporter_forbidden(self): | ||
response = self.client.get(self.url, **self.exporter_headers) | ||
|
||
self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) | ||
|
||
def test_GET_include_non_selectable_for_assessment_param(self): | ||
url = self.url + "?include_non_selectable_for_assessment=True" | ||
response = self.client.get(url, **self.gov_headers) | ||
|
||
self.assertEqual(response.status_code, status.HTTP_200_OK) | ||
|
||
self.assertEqual( | ||
response.json(), | ||
[ | ||
{ | ||
"rating": "ML1", | ||
"text": "some ML1 text", | ||
"parent": None, | ||
}, | ||
{ | ||
"rating": "ML1a", | ||
"text": "some ML1a text", | ||
"parent": str(self.parent_cle.id), | ||
}, | ||
], | ||
) |
Oops, something went wrong.