From 53eeac5c3f6214959571f0254a009606e55dc346 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20PAILHAREY?= <rpailharey@grandlyon.com> Date: Mon, 12 Jun 2023 09:01:08 +0000 Subject: [PATCH] fix: handle pdl starting with 0 --- internal/models/consent.go | 2 +- internal/rootmux/rootmux_test.go | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/models/consent.go b/internal/models/consent.go index 704abdd..6a79ba0 100644 --- a/internal/models/consent.go +++ b/internal/models/consent.go @@ -16,7 +16,7 @@ type Consent struct { Firstname string `json:"firstname"` Lastname string `json:"lastname"` Address string `json:"address"` - PointID int `json:"pointID"` + PointID string `json:"pointID"` PostalCode string `json:"postalCode"` City string `json:"city"` SafetyBoarding bool `json:"safetyOnBoarding"` diff --git a/internal/rootmux/rootmux_test.go b/internal/rootmux/rootmux_test.go index 4df2c3c..4b0c134 100644 --- a/internal/rootmux/rootmux_test.go +++ b/internal/rootmux/rootmux_test.go @@ -30,9 +30,9 @@ var ( partnersInfoStr string customPopupInfo = models.CustomPopup{ID: 1, PopupEnabled: false, Title: "Alerte personnalisée", Description: "Ecolyo 4ever"} customPopupStr string - consent = models.Consent{Firstname: "Foo", Lastname: "Bar", PointID: 123456} + consent = models.Consent{Firstname: "Foo", Lastname: "Bar", PointID: "12345671234567"} consentStr string - otherConsent = models.Consent{Firstname: "John", Lastname: "Doe", PointID: 123789} + otherConsent = models.Consent{Firstname: "John", Lastname: "Doe", PointID: "01234560123456"} otherConsentStr string noH map[string]string ) @@ -272,11 +272,11 @@ func sgeTests(t *testing.T) { // Try to get first 50 consents (must pass) do("GET", "/api/admin/consent?limit=50&page=0", xsrfHeader, "", http.StatusOK, `{"totalRows":2,"rows":[{"ID":2`) // Try to search for both consent (must pass) - do("GET", "/api/admin/consent?search=123&limit=50&page=0", xsrfHeader, "", http.StatusOK, `{"totalRows":2,"rows":[{"ID":2`) + do("GET", "/api/admin/consent?search=123456&limit=50&page=0", xsrfHeader, "", http.StatusOK, `{"totalRows":2,"rows":[{"ID":2`) // Try to search for first point id (must pass) - do("GET", "/api/admin/consent?search=123456&limit=50&page=0", xsrfHeader, "", http.StatusOK, `{"totalRows":1,"rows":[{"ID":1`) + do("GET", "/api/admin/consent?search=12345671234567&limit=50&page=0", xsrfHeader, "", http.StatusOK, `{"totalRows":1,"rows":[{"ID":1`) // Try to search for second point id (must pass) - do("GET", "/api/admin/consent?search=123789&limit=50&page=0", xsrfHeader, "", http.StatusOK, `{"totalRows":1,"rows":[{"ID":2`) + do("GET", "/api/admin/consent?search=01234560123456&limit=50&page=0", xsrfHeader, "", http.StatusOK, `{"totalRows":1,"rows":[{"ID":2`) // Try to search for unknown point id (must pass empty) do("GET", "/api/admin/consent?search=000000&limit=50&page=0", xsrfHeader, "", http.StatusOK, `{"totalRows":0,"rows":[]`) // Try to delete a consent (must pass) -- GitLab