Skip to content

Commit

Permalink
ECIL-222 Schedule EU labels for pre-brexit CFS applications
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeylockwood committed Oct 30, 2024
1 parent 5d2c0e2 commit 623b968
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 4 deletions.
2 changes: 2 additions & 0 deletions web/domains/case/views/views_view_case.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import datetime as dt
from typing import NamedTuple

from django.contrib.auth.decorators import login_required
Expand Down Expand Up @@ -332,6 +333,7 @@ def _view_cfs(
"application_countries": app_countries,
"schedules": application.schedules.all().order_by("created_at"),
"page_title": get_case_page_title("export", application, "View"),
"show_eu_fields": application.submit_datetime < dt.datetime(2021, 1, 1, tzinfo=dt.UTC),
}

return render(request, "web/domains/case/export/cfs-view.html", context)
Expand Down
12 changes: 9 additions & 3 deletions web/templates/web/domains/case/export/cfs-view.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,15 @@
{% if schedule.is_biocidal_claim() and schedule.biocidal_claim %}
{{ application_field(schedule.get_biocidal_claim_display(), labels["biocidal_claim"]) }}
{% endif %}
{{ application_field(schedule.get_product_eligibility_display(), labels["product_eligibility"]) }}
{{ application_field(schedule.get_goods_placed_on_uk_market_display(), labels["goods_placed_on_uk_market"]) }}
{{ application_field(schedule.get_goods_export_only_display(), labels["goods_export_only"]) }}
{% if show_eu_fields %}
{{ application_field(schedule.get_product_eligibility_display().replace(" UK ", " EU ") , labels["product_eligibility"]) }}
{{ application_field(schedule.get_goods_placed_on_uk_market_display(), "Have you placed the goods on the EU market or intend to place on EU market in future?") }}
{{ application_field(schedule.get_goods_export_only_display(), "Are these goods for export only and will never be placed by you on the EU market?") }}
{% else %}
{{ application_field(schedule.get_product_eligibility_display(), labels["product_eligibility"]) }}
{{ application_field(schedule.get_goods_placed_on_uk_market_display(), labels["goods_placed_on_uk_market"]) }}
{{ application_field(schedule.get_goods_export_only_display(), labels["goods_export_only"]) }}
{% endif %}
{{ application_field(schedule.get_any_raw_materials_display(), labels["any_raw_materials"]) }}

{% if schedule.final_product_end_use %}
Expand Down
41 changes: 40 additions & 1 deletion web/tests/domains/case/export/test_views.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import datetime as dt
import re
from http import HTTPStatus

import pytest
from django.urls import reverse, reverse_lazy
from pytest_django.asserts import assertRedirects, assertTemplateUsed
from pytest_django.asserts import assertContains, assertRedirects, assertTemplateUsed

from web.models import (
CertificateApplicationTemplate,
Expand Down Expand Up @@ -329,6 +330,44 @@ def test_edit_cfs_schedule_biocidal_claim_legislation_config(exporter_client, cf
assert legislation_config[chosen_legislation.pk]["isBiocidalClaim"] is True


def test_view_cfs_app_pre_brexit(db, exporter_client, cfs_app_processing):
app = cfs_app_processing
app.submit_datetime = dt.datetime(2020, 12, 31, 7, tzinfo=dt.UTC)
app.save()
url_view = reverse("case:view", kwargs={"case_type": "export", "application_pk": app.pk})
response = exporter_client.post(url_view)

assertContains(
response, "The products meet the product safety requirements to be sold on the EU market"
)
assertContains(
response,
"Have you placed the goods on the EU market or intend to place on EU market in future?",
)
assertContains(
response,
"Are these goods for export only and will never be placed by you on the EU market?",
)


def test_view_cfs_app_post_brexit(exporter_client, cfs_app_processing):
app = cfs_app_processing
url_view = reverse("case:view", kwargs={"case_type": "export", "application_pk": app.pk})
response = exporter_client.post(url_view)

assertContains(
response, "The products meet the product safety requirements to be sold on the UK market"
)
assertContains(
response,
"Have you placed the goods on the UK market or intend to place on UK market in future?",
)
assertContains(
response,
"Are these goods for export only and will never be placed by you on the UK market?",
)


class TestCFSScheduleMangeProductsView(AuthTestCase):
@pytest.fixture(autouse=True)
def setup(self, _setup, cfs_app_in_progress):
Expand Down

0 comments on commit 623b968

Please sign in to comment.