mirror of
1
Fork 0

Improve testing

This commit is contained in:
Gusted 2023-07-20 15:54:19 +02:00
parent 4437292622
commit 56a028ec96
No known key found for this signature in database
GPG Key ID: FD821B732837125F
1 changed files with 18 additions and 17 deletions

View File

@ -4,6 +4,7 @@
package integration
import (
"fmt"
"net/http"
"testing"
@ -290,7 +291,7 @@ func TestGetOpenStreetMapLink(t *testing.T) {
session := loginUser(t, "user2")
for location, encodedLocation := range testLocations {
t.Logf("Testing location %s", location)
t.Run(location, func(t *testing.T) {
req := NewRequestWithValues(t, "POST", "/user/settings", map[string]string{
"_csrf": GetCSRF(t, session, "/user/settings"),
"name": "user2",
@ -302,9 +303,9 @@ func TestGetOpenStreetMapLink(t *testing.T) {
req = NewRequest(t, "GET", "/user2/")
resp := session.MakeRequest(t, req, http.StatusOK)
assert.Contains(t,
resp.Body.String(),
"<a href=\""+"https://www.openstreetmap.org/search?query="+encodedLocation+"\" rel=\"nofollow noreferrer\">",
)
htmlDoc := NewHTMLParser(t, resp.Body)
htmlDoc.AssertElement(t, fmt.Sprintf("a[href='https://www.openstreetmap.org/search?query=%s']", encodedLocation), true)
})
}
}