Files
opencloud/extensions/graph/pkg/service/v0/service_test.go
Christian Richter 4d821cdc9d refactor graph
Signed-off-by: Christian Richter <crichter@owncloud.com>
2022-04-13 17:04:37 +02:00

31 lines
611 B
Go

package svc
import (
"net/http"
"testing"
)
func TestParsePurgeHeader(t *testing.T) {
tests := map[string]bool{
"": false,
"f": false,
"F": false,
"anything": false,
"t": true,
"T": true,
}
for input, expected := range tests {
h := make(http.Header)
h.Add(HeaderPurge, input)
if expected != parsePurgeHeader(h) {
t.Errorf("parsePurgeHeader with input %s got %t expected %t", input, !expected, expected)
}
}
if h := make(http.Header); parsePurgeHeader(h) {
t.Error("parsePurgeHeader without Purge header set got true expected false")
}
}