Fix test
This commit is contained in:
@@ -9,6 +9,7 @@ require (
|
|||||||
github.com/coreos/go-oidc v2.2.1+incompatible
|
github.com/coreos/go-oidc v2.2.1+incompatible
|
||||||
github.com/cs3org/go-cs3apis v0.0.0-20201007120910-416ed6cf8b00
|
github.com/cs3org/go-cs3apis v0.0.0-20201007120910-416ed6cf8b00
|
||||||
github.com/cs3org/reva v1.3.1-0.20201023144216-cdb3d6688da5
|
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/google/uuid v1.1.2
|
||||||
github.com/justinas/alice v1.2.0
|
github.com/justinas/alice v1.2.0
|
||||||
github.com/micro/cli/v2 v2.1.2
|
github.com/micro/cli/v2 v2.1.2
|
||||||
|
|||||||
@@ -10,13 +10,17 @@ func TestSignedURLAuth_shouldServe(t *testing.T) {
|
|||||||
pua := signedURLAuth{}
|
pua := signedURLAuth{}
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
url string
|
url string
|
||||||
|
enabled bool
|
||||||
expected bool
|
expected bool
|
||||||
}{
|
}{
|
||||||
{"https://example.com/example.jpg", false},
|
{"https://example.com/example.jpg", true, false},
|
||||||
{"https://example.com/example.jpg?OC-Signature=something", true},
|
{"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 {
|
for _, tt := range tests {
|
||||||
|
pua.preSignedURLConfig.Enabled = tt.enabled
|
||||||
r := httptest.NewRequest("", tt.url, nil)
|
r := httptest.NewRequest("", tt.url, nil)
|
||||||
result := pua.shouldServe(r)
|
result := pua.shouldServe(r)
|
||||||
|
|
||||||
@@ -102,7 +106,7 @@ func TestSignedURLAuth_urlIsExpired(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
url string
|
url string
|
||||||
isExpired bool
|
isExpired bool
|
||||||
}{
|
}{
|
||||||
{"http://example.com/example.jpg?OC-Date=2020-02-02T12:29:00.000Z&OC-Expires=61", false},
|
{"http://example.com/example.jpg?OC-Date=2020-02-02T12:29:00.000Z&OC-Expires=61", false},
|
||||||
|
|||||||
Reference in New Issue
Block a user