From 2c94e6d56f6444946bcdff3f24776e4532903b8c Mon Sep 17 00:00:00 2001 From: "Panagiotis \"Ivory\" Vasilopoulos" Date: Thu, 20 Jul 2023 13:33:24 +0200 Subject: [PATCH] Add test for OSM feature (doesn't work yet) --- tests/integration/user_test.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/integration/user_test.go b/tests/integration/user_test.go index 3e4d967686..5ea62ec9b7 100644 --- a/tests/integration/user_test.go +++ b/tests/integration/user_test.go @@ -276,3 +276,35 @@ func TestListStopWatches(t *testing.T) { assert.Greater(t, apiWatches[0].Seconds, int64(0)) } } + +func TestGetOpenStreetMapLink(t *testing.T) { + defer tests.PrepareTestEnv(t)() + + testLocations := map[string]string{ + "Αθήνα": "%ce%91%ce%b8%ce%ae%ce%bd%ce%b1", + // " Αθήνα": "%20%20%ce%91%ce%b8%ce%ae%ce%bd%ce%b1", + "Barbarossabrunnen, Düsseldorf": "Barbarossabrunnen%2c%20D%c3%bcsseldorf", + "39.91025,116.40753": "39.91025%2C116.40753", + // "நியூ யோர்க்": "%e0%ae%a8%e0%ae%bf%e0%ae%af%e0%af%82%20%e0%ae%af%e0%af%8b%e0%ae%b0%e0%af%8d%e0%ae%95%e0%af%8d", + } + + session := loginUser(t, "user2") + for location, encodedLocation := range testLocations { + t.Logf("Testing location %s", location) + req := NewRequestWithValues(t, "POST", "/user/settings", map[string]string{ + "_csrf": GetCSRF(t, session, "/user/settings"), + "name": "user2", + "email": "user@example.com", + "language": "en-US", + "location": location, + }) + resp := session.MakeRequest(t, req, http.StatusSeeOther) + + req = NewRequest(t, "GET", "/user2/") + resp = session.MakeRequest(t, req, http.StatusOK) + assert.Contains(t, + resp.Body.String(), + "", + ) + } +}