summaryrefslogtreecommitdiff
path: root/internal/server/api_test.go
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2023-02-16 16:03:46 +0100
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2023-02-16 16:03:46 +0100
commit57705feadd598c9a14df53b83161b8f020731bd6 (patch)
tree0320e7739eca0c0afbe7087340d017413940c31e /internal/server/api_test.go
parent0566c505b1462e47a9dc44d7b26534b41aca1c4f (diff)
Format: Run gofumpt
Diffstat (limited to 'internal/server/api_test.go')
-rw-r--r--internal/server/api_test.go28
1 files changed, 13 insertions, 15 deletions
diff --git a/internal/server/api_test.go b/internal/server/api_test.go
index 00fba3d..b1e3550 100644
--- a/internal/server/api_test.go
+++ b/internal/server/api_test.go
@@ -10,7 +10,6 @@ import (
"github.com/go-errors/errors"
)
-
func getErrorMsg(err error) string {
if err == nil {
return ""
@@ -44,49 +43,49 @@ func Test_APIGetEndpoints(t *testing.T) {
}{
{
epl: EndpointList{
- API: "https://example.com/1",
+ API: "https://example.com/1",
Authorization: "https://example.com/2",
- Token: "https://example.com/3",
+ Token: "https://example.com/3",
},
err: nil,
},
{
epl: EndpointList{
- API: "http://example.com/1",
+ API: "http://example.com/1",
Authorization: "https://example.com/2",
- Token: "https://example.com/3",
+ Token: "https://example.com/3",
},
err: errors.New("API scheme: 'http', is not equal to authorization scheme: 'https'"),
},
{
epl: EndpointList{
- API: "https://example.com/1",
+ API: "https://example.com/1",
Authorization: "https://example.com/2",
- Token: "ftp://example.com/3",
+ Token: "ftp://example.com/3",
},
err: errors.New("API scheme: 'https', is not equal to token scheme: 'ftp'"),
},
{
epl: EndpointList{
- API: "https://malicious.com/1",
+ API: "https://malicious.com/1",
Authorization: "https://example.com/2",
- Token: "https://example.com/3",
+ Token: "https://example.com/3",
},
err: errors.New("API host: 'malicious.com', is not equal to authorization host: 'example.com'"),
},
{
epl: EndpointList{
- API: "https://example.com/1",
+ API: "https://example.com/1",
Authorization: "https://example.com/2",
- Token: "https://malicious.com/3",
+ Token: "https://malicious.com/3",
},
err: errors.New("API host: 'example.com', is not equal to token host: 'malicious.com'"),
},
{
epl: EndpointList{
- API: "https://example.com/1",
+ API: "https://example.com/1",
Authorization: "https://malicious.com/2",
- Token: "https://example.com/3",
+ Token: "https://example.com/3",
},
err: errors.New("API host: 'example.com', is not equal to authorization host: 'malicious.com'"),
},
@@ -99,7 +98,7 @@ func Test_APIGetEndpoints(t *testing.T) {
},
}
// Update the handler
- hs.SetHandler(http.HandlerFunc(func (w http.ResponseWriter, r *http.Request) {
+ hs.SetHandler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
jsonStr, err := json.Marshal(ep)
@@ -108,7 +107,6 @@ func Test_APIGetEndpoints(t *testing.T) {
}
fmt.Fprintln(w, string(jsonStr))
-
}))
gotEP, err := APIGetEndpoints(s.URL, c)
if getErrorMsg(err) != getErrorMsg(tc.err) {