mirror of
https://github.com/restic/rest-server.git
synced 2025-12-07 09:36:13 -08:00
Vendor dependencies
This commit is contained in:
committed by
Zlatko Čalušić
parent
2f0a16d8b7
commit
6054876201
83
vendor/goji.io/pat/methods_test.go
generated
vendored
Normal file
83
vendor/goji.io/pat/methods_test.go
generated
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
package pat
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestDelete(t *testing.T) {
|
||||
t.Parallel()
|
||||
pat := Delete("/")
|
||||
if pat.Match(mustReq("GET", "/")) != nil {
|
||||
t.Errorf("pattern was DELETE, but matched GET")
|
||||
}
|
||||
if pat.Match(mustReq("DELETE", "/")) == nil {
|
||||
t.Errorf("pattern didn't match DELETE")
|
||||
}
|
||||
}
|
||||
|
||||
func TestGet(t *testing.T) {
|
||||
t.Parallel()
|
||||
pat := Get("/")
|
||||
if pat.Match(mustReq("POST", "/")) != nil {
|
||||
t.Errorf("pattern was GET, but matched POST")
|
||||
}
|
||||
if pat.Match(mustReq("GET", "/")) == nil {
|
||||
t.Errorf("pattern didn't match GET")
|
||||
}
|
||||
if pat.Match(mustReq("HEAD", "/")) == nil {
|
||||
t.Errorf("pattern didn't match HEAD")
|
||||
}
|
||||
}
|
||||
|
||||
func TestHead(t *testing.T) {
|
||||
t.Parallel()
|
||||
pat := Head("/")
|
||||
if pat.Match(mustReq("GET", "/")) != nil {
|
||||
t.Errorf("pattern was HEAD, but matched GET")
|
||||
}
|
||||
if pat.Match(mustReq("HEAD", "/")) == nil {
|
||||
t.Errorf("pattern didn't match HEAD")
|
||||
}
|
||||
}
|
||||
|
||||
func TestOptions(t *testing.T) {
|
||||
t.Parallel()
|
||||
pat := Options("/")
|
||||
if pat.Match(mustReq("GET", "/")) != nil {
|
||||
t.Errorf("pattern was OPTIONS, but matched GET")
|
||||
}
|
||||
if pat.Match(mustReq("OPTIONS", "/")) == nil {
|
||||
t.Errorf("pattern didn't match OPTIONS")
|
||||
}
|
||||
}
|
||||
|
||||
func TestPatch(t *testing.T) {
|
||||
t.Parallel()
|
||||
pat := Patch("/")
|
||||
if pat.Match(mustReq("GET", "/")) != nil {
|
||||
t.Errorf("pattern was PATCH, but matched GET")
|
||||
}
|
||||
if pat.Match(mustReq("PATCH", "/")) == nil {
|
||||
t.Errorf("pattern didn't match PATCH")
|
||||
}
|
||||
}
|
||||
|
||||
func TestPost(t *testing.T) {
|
||||
t.Parallel()
|
||||
pat := Post("/")
|
||||
if pat.Match(mustReq("GET", "/")) != nil {
|
||||
t.Errorf("pattern was POST, but matched GET")
|
||||
}
|
||||
if pat.Match(mustReq("POST", "/")) == nil {
|
||||
t.Errorf("pattern didn't match POST")
|
||||
}
|
||||
}
|
||||
|
||||
func TestPut(t *testing.T) {
|
||||
t.Parallel()
|
||||
pat := Put("/")
|
||||
if pat.Match(mustReq("GET", "/")) != nil {
|
||||
t.Errorf("pattern was PUT, but matched GET")
|
||||
}
|
||||
if pat.Match(mustReq("PUT", "/")) == nil {
|
||||
t.Errorf("pattern didn't match PUT")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user