Improve testing
This commit is contained in:
parent
4437292622
commit
56a028ec96
1 changed files with 18 additions and 17 deletions
|
@ -4,6 +4,7 @@
|
||||||
package integration
|
package integration
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
@ -290,7 +291,7 @@ func TestGetOpenStreetMapLink(t *testing.T) {
|
||||||
|
|
||||||
session := loginUser(t, "user2")
|
session := loginUser(t, "user2")
|
||||||
for location, encodedLocation := range testLocations {
|
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{
|
req := NewRequestWithValues(t, "POST", "/user/settings", map[string]string{
|
||||||
"_csrf": GetCSRF(t, session, "/user/settings"),
|
"_csrf": GetCSRF(t, session, "/user/settings"),
|
||||||
"name": "user2",
|
"name": "user2",
|
||||||
|
@ -302,9 +303,9 @@ func TestGetOpenStreetMapLink(t *testing.T) {
|
||||||
|
|
||||||
req = NewRequest(t, "GET", "/user2/")
|
req = NewRequest(t, "GET", "/user2/")
|
||||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||||
assert.Contains(t,
|
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||||
resp.Body.String(),
|
|
||||||
"<a href=\""+"https://www.openstreetmap.org/search?query="+encodedLocation+"\" rel=\"nofollow noreferrer\">",
|
htmlDoc.AssertElement(t, fmt.Sprintf("a[href='https://www.openstreetmap.org/search?query=%s']", encodedLocation), true)
|
||||||
)
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue