-
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.
Browse files
Browse the repository at this point in the history
NLR advice doesn't conflict
- Loading branch information
Showing
5 changed files
with
51 additions
and
8 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
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 |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
from api.teams.models import Team | ||
from api.users.tests.factories import GovUserFactory | ||
from test_helpers.clients import DataTestClient | ||
from api.users.models import GovUser, Role | ||
from api.users.models import Role | ||
|
||
|
||
class CreateCaseAdviceTests(DataTestClient): | ||
|
@@ -52,6 +52,7 @@ def setUp(self): | |
self.gov_user_3 = GovUserFactory(baseuser_ptr__email="[email protected]", team=team_3, role=role) | ||
|
||
self.standard_case_url = reverse("cases:case_final_advice", kwargs={"pk": self.standard_case.id}) | ||
self.standard_case_finalise_url = reverse("applications:finalise", kwargs={"pk": self.standard_case.id}) | ||
|
||
def test_advice_is_concatenated_when_final_advice_first_created(self): | ||
""" | ||
|
@@ -95,6 +96,32 @@ def test_create_conflicting_final_advice_shows_all_fields(self): | |
self.assertEqual(response_data.get("proviso"), "I am easy to proviso") | ||
self.assertCountEqual(["1a", "1b", "1c"], response_data["denial_reasons"]) | ||
|
||
def test_create_final_advice_nlr_overrides_approval(self): | ||
""" | ||
NLR decision overrides approval | ||
""" | ||
self.create_advice(self.gov_user, self.standard_case, "good", AdviceType.NO_LICENCE_REQUIRED, AdviceLevel.TEAM) | ||
self.create_advice(self.gov_user_3, self.standard_case, "good", AdviceType.APPROVE, AdviceLevel.TEAM) | ||
|
||
response = self.client.get(self.standard_case_url, **self.gov_headers) | ||
response_data = response.json()["advice"][0] | ||
|
||
self.assertEqual(response_data.get("type").get("key"), "no_licence_required") | ||
|
||
def test_return_final_advice(self): | ||
""" | ||
Check the correct advice is returned | ||
""" | ||
self.create_advice(self.gov_user_2, self.standard_case, "good", AdviceType.APPROVE, AdviceLevel.TEAM) | ||
self.create_advice(self.gov_user, self.standard_case, "good", AdviceType.NO_LICENCE_REQUIRED, AdviceLevel.TEAM) | ||
self.create_advice(self.gov_user, self.standard_case, "good", AdviceType.NO_LICENCE_REQUIRED, AdviceLevel.FINAL) | ||
self.create_advice(self.gov_user_2, self.standard_case, "end_user", AdviceType.APPROVE, AdviceLevel.FINAL) | ||
|
||
response = self.client.get(self.standard_case_finalise_url, **self.gov_headers) | ||
final_advice_on_goods = response.json()["goods"] | ||
|
||
self.assertEqual(len(final_advice_on_goods), 1) | ||
|
||
def test_create_final_advice_same_advice_type_different_pv_gradings(self): | ||
""" | ||
Same advice types, different pv gradings | ||
|