Skip to content

Commit

Permalink
Remove unsupported HmrcQuery type related code
Browse files Browse the repository at this point in the history
We don't support this yet. The current implementation may not be relevant
if we need to support it and can be added based on the requirement
at that time.
  • Loading branch information
saruniitr committed Feb 2, 2024
1 parent aa268d7 commit 750093c
Show file tree
Hide file tree
Showing 25 changed files with 27 additions and 867 deletions.
3 changes: 0 additions & 3 deletions api/applications/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,3 @@

class ApplicationsConfig(AppConfig):
name = "api.applications"

def ready(self):
import api.applications.signals # noqa
11 changes: 0 additions & 11 deletions api/applications/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@
GiftingClearanceViewSerializer,
GiftingClearanceUpdateSerializer,
)
from api.applications.serializers.hmrc_query import (
HmrcQueryCreateSerializer,
HmrcQueryViewSerializer,
HmrcQueryUpdateSerializer,
)
from api.applications.serializers.open_application import (
OpenApplicationCreateSerializer,
OpenApplicationUpdateSerializer,
Expand Down Expand Up @@ -61,8 +56,6 @@ def get_application_view_serializer(application: BaseApplication):
return StandardApplicationViewSerializer
elif application.case_type.sub_type == CaseTypeSubTypeEnum.OPEN:
return OpenApplicationViewSerializer
elif application.case_type.sub_type == CaseTypeSubTypeEnum.HMRC:
return HmrcQueryViewSerializer
elif application.case_type.sub_type == CaseTypeSubTypeEnum.EXHIBITION:
return ExhibitionClearanceViewSerializer
elif application.case_type.sub_type == CaseTypeSubTypeEnum.GIFTING:
Expand All @@ -85,8 +78,6 @@ def get_application_create_serializer(case_type):
return StandardApplicationCreateSerializer
elif sub_type == CaseTypeSubTypeEnum.OPEN:
return OpenApplicationCreateSerializer
elif sub_type == CaseTypeSubTypeEnum.HMRC:
return HmrcQueryCreateSerializer
elif sub_type == CaseTypeSubTypeEnum.EXHIBITION:
return ExhibitionClearanceCreateSerializer
elif sub_type == CaseTypeSubTypeEnum.GIFTING:
Expand All @@ -102,8 +93,6 @@ def get_application_update_serializer(application: BaseApplication):
return StandardApplicationUpdateSerializer
elif application.case_type.sub_type == CaseTypeSubTypeEnum.OPEN:
return OpenApplicationUpdateSerializer
elif application.case_type.sub_type == CaseTypeSubTypeEnum.HMRC:
return HmrcQueryUpdateSerializer
elif application.case_type.sub_type == CaseTypeSubTypeEnum.EXHIBITION:
return ExhibitionClearanceUpdateSerializer
elif application.case_type.sub_type == CaseTypeSubTypeEnum.GIFTING:
Expand Down
4 changes: 0 additions & 4 deletions api/applications/libraries/get_applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
GiftingClearanceApplication,
OpenApplication,
StandardApplication,
HmrcQuery,
ExhibitionClearanceApplication,
)
from api.cases.enums import CaseTypeSubTypeEnum
Expand Down Expand Up @@ -77,8 +76,6 @@ def get_application(pk, organisation_id=None):
return obj
elif application_type == CaseTypeSubTypeEnum.OPEN:
return OpenApplication.objects.get(pk=pk, **kwargs)
elif application_type == CaseTypeSubTypeEnum.HMRC:
return HmrcQuery.objects.get(pk=pk)
elif application_type == CaseTypeSubTypeEnum.EXHIBITION:
return ExhibitionClearanceApplication.objects.get(pk=pk)
elif application_type == CaseTypeSubTypeEnum.GIFTING:
Expand All @@ -90,7 +87,6 @@ def get_application(pk, organisation_id=None):
except (
StandardApplication.DoesNotExist,
OpenApplication.DoesNotExist,
HmrcQuery.DoesNotExist,
):
raise NotFoundError({"application": "Application not found - " + str(pk)})

Expand Down
87 changes: 0 additions & 87 deletions api/applications/serializers/hmrc_query.py

This file was deleted.

15 changes: 0 additions & 15 deletions api/applications/signals.py

This file was deleted.

13 changes: 0 additions & 13 deletions api/applications/tests/test_application_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,19 +353,6 @@ def test_case_routing_automation(self):
["Licensing Unit Pre-circulation Cases to Review", "new queue"],
)

def test_gov_user_set_hmrc_status_closed_success(self):
self.hmrc_query = self.create_hmrc_query(self.organisation)
self.submit_application(self.hmrc_query)

data = {"status": CaseStatusEnum.CLOSED}
url = reverse("applications:manage_status", kwargs={"pk": self.hmrc_query.id})
response = self.client.put(url, data=data, **self.gov_headers)

self.hmrc_query.refresh_from_db()

self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(self.hmrc_query.status, get_case_status_by_status(CaseStatusEnum.CLOSED))

@parameterized.expand(
[
(
Expand Down
42 changes: 0 additions & 42 deletions api/applications/tests/test_copy_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from api.applications.models import (
StandardApplication,
OpenApplication,
HmrcQuery,
GoodOnApplication,
CountryOnApplication,
SiteOnApplication,
Expand Down Expand Up @@ -406,47 +405,6 @@ def test_copy_submitted_F680_application_successful(self):

self._validate_F680_application()

def test_copy_draft_hmrc_enquiry_successful(self):
"""
Ensure we can copy an hmrc enquiry that is a draft
"""
self.original_application = self.create_hmrc_query(self.organisation)

self.url = reverse_lazy("applications:copy", kwargs={"pk": self.original_application.id})

self.data = {"name": "New application"}

self.response = self.client.post(self.url, self.data, **self.exporter_headers)
self.response_data = self.response.json()["data"]

self.assertEqual(self.response.status_code, status.HTTP_201_CREATED)
self.assertNotEqual(self.response_data, self.original_application.id)

self.copied_application = HmrcQuery.objects.get(id=self.response_data)

self._validate_hmrc_enquiry()

def test_copy_submitted_hmrc_enquiry_successful(self):
"""
Ensure we can copy an hmrc enquiry that is submitted ongoing or otherwise
"""
self.original_application = self.create_hmrc_query(self.organisation)
self.submit_application(self.original_application)

self.url = reverse_lazy("applications:copy", kwargs={"pk": self.original_application.id})

self.data = {"name": "New application"}

self.response = self.client.post(self.url, self.data, **self.exporter_headers)
self.response_data = self.response.json()["data"]

self.assertEqual(self.response.status_code, status.HTTP_201_CREATED)
self.assertNotEqual(self.response_data, self.original_application.id)

self.copied_application = HmrcQuery.objects.get(id=self.response_data)

self._validate_hmrc_enquiry()

def _validate_standard_application(self):
self._validate_reset_data()
self._validate_end_use_details()
Expand Down
30 changes: 0 additions & 30 deletions api/applications/tests/test_create_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from api.applications.models import (
StandardApplication,
OpenApplication,
HmrcQuery,
BaseApplication,
ExhibitionClearanceApplication,
GiftingClearanceApplication,
Expand Down Expand Up @@ -135,35 +134,6 @@ def test_create_draft_open_application_successful(self):
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
self.assertEqual(OpenApplication.objects.count(), 1)

def test_create_draft_hmrc_query_successful(self):
"""
Ensure we can create a new HMRC query draft object
"""
data = {
"name": "Test",
"application_type": CaseTypeReferenceEnum.CRE,
"organisation": self.organisation.id,
}

response = self.client.post(self.url, data, **self.hmrc_exporter_headers)

self.assertEqual(response.status_code, status.HTTP_201_CREATED)
self.assertEqual(HmrcQuery.objects.count(), 1)

def test_create_draft_hmrc_query_failure(self):
"""
Ensure that a normal exporter cannot create an HMRC query
"""
data = {
"application_type": CaseTypeReferenceEnum.CRE,
"organisation": self.organisation.id,
}

response = self.client.post(self.url, data, **self.exporter_headers)

self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
self.assertEqual(HmrcQuery.objects.count(), 0)

@parameterized.expand(
[
[{}],
Expand Down
4 changes: 0 additions & 4 deletions api/applications/tests/test_delete_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ def setUp(self):
super().setUp()
self.applications = {
CaseTypeSubTypeEnum.STANDARD: self.create_draft_standard_application(self.organisation),
CaseTypeSubTypeEnum.HMRC: self.create_hmrc_query(self.organisation),
CaseTypeSubTypeEnum.EXHIBITION: self.create_mod_clearance_application(
self.organisation, case_type=CaseTypeEnum.EXHIBITION
),
Expand All @@ -30,7 +29,6 @@ def setUp(self):
[
(CaseTypeSubTypeEnum.STANDARD, "EXPORTER"),
(CaseTypeSubTypeEnum.EXHIBITION, "EXPORTER"),
(CaseTypeSubTypeEnum.HMRC, "HMRC"),
(CaseTypeSubTypeEnum.GIFTING, "EXPORTER"),
(CaseTypeSubTypeEnum.F680, "EXPORTER"),
]
Expand All @@ -57,7 +55,6 @@ def test_delete_draft_application_as_valid_user_success(self, application_type,
(CaseTypeSubTypeEnum.EXHIBITION, "GOV"),
(CaseTypeSubTypeEnum.GIFTING, "GOV"),
(CaseTypeSubTypeEnum.F680, "GOV"),
(CaseTypeSubTypeEnum.HMRC, "EXPORTER"),
]
)
def test_delete_draft_application_as_invalid_user_failure(self, application_type, user):
Expand All @@ -78,7 +75,6 @@ def test_delete_draft_application_as_invalid_user_failure(self, application_type
[
(CaseTypeSubTypeEnum.STANDARD, "EXPORTER"),
(CaseTypeSubTypeEnum.EXHIBITION, "EXPORTER"),
(CaseTypeSubTypeEnum.HMRC, "HMRC"),
(CaseTypeSubTypeEnum.GIFTING, "EXPORTER"),
(CaseTypeSubTypeEnum.F680, "EXPORTER"),
]
Expand Down
Loading

0 comments on commit 750093c

Please sign in to comment.