aboutsummaryrefslogtreecommitdiff
path: root/pkg/instance/instance_test.go
blob: 00d996dcb44cc05d995f50c6701bbbfc35ab7b35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package instance

import (
	"net/http"
	"testing"
)

func CheckHTTPMethod(t *testing.T) {
	var instance Instance
	for _, table := range []struct {
		method string
		wantOK bool
	}{
		{wantOK: false, method: http.MethodHead},
		{wantOK: true, method: http.MethodPost},
		{wantOK: true, method: http.MethodGet},
	} {
		ok := instance.checkHTTPMethod(table.method)
		if got, want := ok, table.wantOK; got != want {
			t.Errorf("%s: got %v but wanted %v", table.method, got, want)
		}
	}
}