This commit is contained in:
Benedikt Kulmann
2020-11-21 07:58:19 +01:00
parent edc252e1a0
commit bc6227e8fd
2 changed files with 8 additions and 3 deletions

View File

@@ -9,6 +9,7 @@ require (
github.com/coreos/go-oidc v2.2.1+incompatible
github.com/cs3org/go-cs3apis v0.0.0-20201007120910-416ed6cf8b00
github.com/cs3org/reva v1.3.1-0.20201023144216-cdb3d6688da5
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/google/uuid v1.1.2
github.com/justinas/alice v1.2.0
github.com/micro/cli/v2 v2.1.2

View File

@@ -10,13 +10,17 @@ func TestSignedURLAuth_shouldServe(t *testing.T) {
pua := signedURLAuth{}
tests := []struct {
url string
enabled bool
expected bool
}{
{"https://example.com/example.jpg", false},
{"https://example.com/example.jpg?OC-Signature=something", true},
{"https://example.com/example.jpg", true, false},
{"https://example.com/example.jpg?OC-Signature=something", true, true},
{"https://example.com/example.jpg", false, false},
{"https://example.com/example.jpg?OC-Signature=something", false, false},
}
for _, tt := range tests {
pua.preSignedURLConfig.Enabled = tt.enabled
r := httptest.NewRequest("", tt.url, nil)
result := pua.shouldServe(r)
@@ -102,7 +106,7 @@ func TestSignedURLAuth_urlIsExpired(t *testing.T) {
}
tests := []struct {
url string
url string
isExpired bool
}{
{"http://example.com/example.jpg?OC-Date=2020-02-02T12:29:00.000Z&OC-Expires=61", false},