Skip to content

Commit

Permalink
Fix test execution
Browse files Browse the repository at this point in the history
  • Loading branch information
PascalMinder committed Mar 14, 2021
1 parent 18fc1ee commit 9629fa8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 7 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": []
}
8 changes: 4 additions & 4 deletions geoblock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestAllowedContry(t *testing.T) {

handler.ServeHTTP(recorder, req)

assertStatusCode(t, req, http.StatusOK)
assertStatusCode(t, recorder.Result(), http.StatusOK)
}

func TestDeniedContry(t *testing.T) {
Expand All @@ -66,13 +66,13 @@ func TestDeniedContry(t *testing.T) {

handler.ServeHTTP(recorder, req)

assertStatusCode(t, req, http.StatusOK)
assertStatusCode(t, recorder.Result(), http.StatusForbidden)
}

func assertStatusCode(t *testing.T, req *http.Request, expected int) {
func assertStatusCode(t *testing.T, req *http.Response, expected int) {
t.Helper()

received := req.Response.StatusCode
received := req.StatusCode

if received != expected {
t.Errorf("invalid status code: %d <> %d", expected, received)
Expand Down

0 comments on commit 9629fa8

Please sign in to comment.