Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
diego-m-ob committed Oct 19, 2024
1 parent 8561c14 commit d92e593
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions pkg/server/config_handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ func TestServerConfigGlobalPostValid(t *testing.T) {
require.JSONEq(bodyExpected, bodyActual)

require.Equal(http.StatusCreated, code)
require.Equal(len(expectedJSONHeaders()), len(headers))
require.Equal(expectedJSONHeaders(), headers)
}

Expand Down
6 changes: 6 additions & 0 deletions pkg/server/export_handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ func TestServerPostExport(t *testing.T) {
MIMEApplicationZIP,
},
"Content-Security-Policy": []string{"default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:; connect-src 'self' ws: wss:;"},
"X-Xss-Protection": []string{"1; mode=block"},
"X-Content-Type-Options": []string{"nosniff"},
"X-Frame-Options": []string{"SAMEORIGIN"},
// echo.HeaderContentDisposition: []string{
// `attachment; filename="report.zip"`,
// },
Expand Down Expand Up @@ -222,6 +225,9 @@ func TestServerPostExportInvalidRequest(t *testing.T) {
echo.MIMEApplicationJSONCharsetUTF8,
},
"Content-Security-Policy": []string{"default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:; connect-src 'self' ws: wss:;"},
"X-Xss-Protection": []string{"1; mode=block"},
"X-Content-Type-Options": []string{"nosniff"},
"X-Frame-Options": []string{"SAMEORIGIN"},
}, headers, body.String())
}
}
7 changes: 5 additions & 2 deletions pkg/server/server_common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ import (

func expectedJSONHeaders() http.Header {
return http.Header{
"Vary": []string{"Accept-Encoding"},
"Content-Type": []string{"application/json; charset=UTF-8"},
"Content-Security-Policy": []string{"default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:; connect-src 'self' ws: wss:;"},
"X-Xss-Protection": []string{"1; mode=block"},
"X-Content-Type-Options": []string{"nosniff"},
"X-Frame-Options": []string{"SAMEORIGIN"},
"Content-Type": []string{"application/json; charset=UTF-8"},
"Vary": []string{"Accept-Encoding"},
}
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func TestServerConformanceSuiteCallback(t *testing.T) {

// do assertions.
require.Equal(http.StatusOK, code)
require.Len(headers, 6)
require.Len(headers, 9)
require.Equal("text/html; charset=utf-8", headers["Content-Type"][0])
require.NotNil(body)

Expand Down
2 changes: 1 addition & 1 deletion pkg/server/swagger_handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func TestServerSwaggerHandlersServesUI(t *testing.T) {
require.Equal(bodyExpected, bodyActual)

require.Equal(http.StatusOK, code)
require.Len(headers, 3)
require.Len(headers, 6)
require.Equal("text/html; charset=utf-8", headers["Content-Type"][0])
})
}
Expand Down

0 comments on commit d92e593

Please sign in to comment.