From 218a5445a45ede12481a63f4b6a409874d1a14d9 Mon Sep 17 00:00:00 2001
From: Xavier Fernandez
Date: Mon, 27 Jan 2025 11:43:55 +0100
Subject: [PATCH] apply: make table view the default for prescribers
---
itou/www/apply/views/list_views.py | 2 +-
tests/www/apply/__snapshots__/test_list.ambr | 12 ++++-----
tests/www/apply/test_list.py | 2 +-
tests/www/apply/test_list_prescriptions.py | 27 ++++++++++++--------
4 files changed, 24 insertions(+), 19 deletions(-)
diff --git a/itou/www/apply/views/list_views.py b/itou/www/apply/views/list_views.py
index 80a666f2774..11e3bf9c7c5 100644
--- a/itou/www/apply/views/list_views.py
+++ b/itou/www/apply/views/list_views.py
@@ -206,7 +206,7 @@ def list_prescriptions(request, template_name="apply/list_prescriptions.html"):
try:
display_kind = JobApplicationsDisplayKind(request.GET.get("display"))
except ValueError:
- display_kind = JobApplicationsDisplayKind.LIST
+ display_kind = JobApplicationsDisplayKind.TABLE
context = {
"title": title,
diff --git a/tests/www/apply/__snapshots__/test_list.ambr b/tests/www/apply/__snapshots__/test_list.ambr
index 540da099deb..3562eb6637f 100644
--- a/tests/www/apply/__snapshots__/test_list.ambr
+++ b/tests/www/apply/__snapshots__/test_list.ambr
@@ -244,7 +244,7 @@
chez
-
+
Hit pit
@@ -298,7 +298,7 @@
@@ -321,7 +321,7 @@
chez
-
+
Hit pit
@@ -380,7 +380,7 @@
- Voir sa candidature
+ Voir sa candidature
@@ -403,7 +403,7 @@
chez
-
+
Hit pit
@@ -462,7 +462,7 @@
- Voir sa candidature
+ Voir sa candidature
diff --git a/tests/www/apply/test_list.py b/tests/www/apply/test_list.py
index f4e86d9a3b3..498081b4671 100644
--- a/tests/www/apply/test_list.py
+++ b/tests/www/apply/test_list.py
@@ -57,7 +57,7 @@ def test_list_warns_about_long_awaiting_applications(client, snapshot):
assert str(results_section) == snapshot(name="SIAE - warnings for 2222 and 3333")
client.force_login(sender)
- response = client.get(reverse("apply:list_prescriptions"))
+ response = client.get(reverse("apply:list_prescriptions"), {"display": JobApplicationsDisplayKind.LIST})
results_section = parse_response_to_soup(response, selector="#job-applications-section")
assert str(results_section) == snapshot(name="PRESCRIBER - warnings for 2222 and 3333")
diff --git a/tests/www/apply/test_list_prescriptions.py b/tests/www/apply/test_list_prescriptions.py
index 5de1f365c6a..d0afee046aa 100644
--- a/tests/www/apply/test_list_prescriptions.py
+++ b/tests/www/apply/test_list_prescriptions.py
@@ -45,7 +45,7 @@ def test_get(client):
organization = job_application.sender_prescriber_organization
client.force_login(job_application.sender)
- response = client.get(reverse("apply:list_prescriptions"))
+ response = client.get(reverse("apply:list_prescriptions"), {"display": JobApplicationsDisplayKind.LIST})
# Has link to export with back_url set
exports_link = unquote(
add_url_params(reverse("apply:list_prescriptions_exports"), {"back_url": reverse("apply:list_prescriptions")})
@@ -95,7 +95,7 @@ def test_as_unauthorized_prescriber(client, snapshot):
list_url = reverse("apply:list_prescriptions")
with assertSnapshotQueries(snapshot(name="SQL queries for prescriptions list")):
- response = client.get(list_url)
+ response = client.get(list_url, {"display": JobApplicationsDisplayKind.LIST})
assertContains(response, "S… U…
")
assertNotContains(response, "Supersecretname")
@@ -224,8 +224,8 @@ def test_list_display_kind(client):
LIST_VIEW_MARKER = '