From 8dfc9ff403e1b3b23720972f62c9d805b2b419bb Mon Sep 17 00:00:00 2001 From: Christophe Henry Date: Mon, 28 Oct 2024 10:33:30 +0100 Subject: [PATCH] Fix tests --- aidants_connect/urls.py | 5 + ...eric-habilitation-request-profile-card.css | 1 - ...eric-habilitation-request-profile-card.mjs | 2 +- .../templates/layouts/main.html | 6 + aidants_connect_habilitation/api/views.py | 9 + .../common/_recap_general_info.html | 6 +- .../common/_recap_personnes.html | 32 ++- .../validation_form.html | 8 +- .../templates/view_organisation_request.html | 60 +++--- .../tests/test_views.py | 186 +++++------------- aidants_connect_habilitation/urls.py | 3 +- 11 files changed, 129 insertions(+), 189 deletions(-) diff --git a/aidants_connect/urls.py b/aidants_connect/urls.py index 6de5ed2f0..30e9d75d8 100644 --- a/aidants_connect/urls.py +++ b/aidants_connect/urls.py @@ -17,6 +17,11 @@ path("", include("aidants_connect_web.urls")), path("habilitation/", include("aidants_connect_habilitation.urls")), path("", include("aidants_connect_pico_cms.urls")), + # APIs + path( + "api/habilitation/", + include("aidants_connect_habilitation.api.urls"), + ), ] if "test" in sys.argv: diff --git a/aidants_connect_common/static/css/generic-habilitation-request-profile-card.css b/aidants_connect_common/static/css/generic-habilitation-request-profile-card.css index b16ce47ac..e01975e34 100644 --- a/aidants_connect_common/static/css/generic-habilitation-request-profile-card.css +++ b/aidants_connect_common/static/css/generic-habilitation-request-profile-card.css @@ -28,5 +28,4 @@ details.request-card-details .details-content { padding: inherit; position: absolute; width: 100%; - z-index: 11; } diff --git a/aidants_connect_common/static/js/generic-habilitation-request-profile-card.mjs b/aidants_connect_common/static/js/generic-habilitation-request-profile-card.mjs index 5a05cd27e..bf5382e94 100644 --- a/aidants_connect_common/static/js/generic-habilitation-request-profile-card.mjs +++ b/aidants_connect_common/static/js/generic-habilitation-request-profile-card.mjs @@ -11,7 +11,7 @@ import {aidantsConnectApplicationReady, BaseController} from "AidantsConnectAppl * @property {ProfileEditCard[]} profileEditCardOutlets * @property {Number} idValue * @property {Number} stateValue - * @property {Number} displayValue + * @property {Boolean} displayValue */ class ProfileEditModal extends BaseController { static STATES = Object.freeze({ diff --git a/aidants_connect_common/templates/layouts/main.html b/aidants_connect_common/templates/layouts/main.html index 2504f75d3..f0f639d32 100644 --- a/aidants_connect_common/templates/layouts/main.html +++ b/aidants_connect_common/templates/layouts/main.html @@ -16,6 +16,9 @@ + {% if form.media %} + {{ form.media.render_css }} + {% endif %} {# Extra styles #} {% block extracss %}{% endblock %} @@ -84,6 +87,9 @@ +{% if form.media %} + {{ form.media.render_js }} +{% endif %} {% block extrajs %}{% endblock %} diff --git a/aidants_connect_habilitation/api/views.py b/aidants_connect_habilitation/api/views.py index c3bdc5958..0f198a000 100644 --- a/aidants_connect_habilitation/api/views.py +++ b/aidants_connect_habilitation/api/views.py @@ -27,6 +27,12 @@ def setup(self, request, *args, **kwargs): pk=self.kwargs.get("aidant_id"), ) + def dispatch(self, request, *args, **kwargs): + return super().dispatch(request, *args, **kwargs) + + def get(self, request, *args, **kwargs): + return super().get(request, *args, **kwargs) + def get_form_kwargs(self): return { "organisation": self.organisation, @@ -60,6 +66,9 @@ def get_template_names(self): else: return "forms/form.html" + def form_invalid(self, form): + return self.render_to_response(self.get_context_data(form=form), status=422) + def form_valid(self, form): habilitation_request = form.save() self.success = True diff --git a/aidants_connect_habilitation/templates/aidants_connect_habilitation/common/_recap_general_info.html b/aidants_connect_habilitation/templates/aidants_connect_habilitation/common/_recap_general_info.html index 8cfb42f53..9e098ddd2 100644 --- a/aidants_connect_habilitation/templates/aidants_connect_habilitation/common/_recap_general_info.html +++ b/aidants_connect_habilitation/templates/aidants_connect_habilitation/common/_recap_general_info.html @@ -17,7 +17,7 @@

Structure

{{ issuer.email }}
{{ issuer.phone }}

- {% if show_edit_buttons %} + {% if show_edit_buttons or organisation.status in organisation.Status.validatable %} - {% if show_edit_buttons or organisation.status == organisation.Status.CHANGES_REQUIRED %} + {% if show_edit_buttons or organisation.status in organisation.Status.validatable %} {% endif %} diff --git a/aidants_connect_habilitation/templates/aidants_connect_habilitation/common/_recap_personnes.html b/aidants_connect_habilitation/templates/aidants_connect_habilitation/common/_recap_personnes.html index 122feb178..8fe82a6e8 100644 --- a/aidants_connect_habilitation/templates/aidants_connect_habilitation/common/_recap_personnes.html +++ b/aidants_connect_habilitation/templates/aidants_connect_habilitation/common/_recap_personnes.html @@ -45,15 +45,17 @@

Référents

{{ organisation.manager.organisation }}
{% else %}