MCPcopy
hub / github.com/git-lfs/git-lfs / TestAuthenticateHeaderAccess

Function TestAuthenticateHeaderAccess

lfsapi/auth_test.go:25–46  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

23}
24
25func TestAuthenticateHeaderAccess(t *testing.T) {
26 tests := map[string]creds.AccessMode{
27 "": creds.BasicAccess,
28 "basic 123": creds.BasicAccess,
29 "basic": creds.BasicAccess,
30 "unknown": creds.BasicAccess,
31 "NEGOTIATE": creds.NegotiateAccess,
32 "negotiate": creds.NegotiateAccess,
33 "NEGOTIATE 1 2 3": creds.NegotiateAccess,
34 "negotiate 1 2 3": creds.NegotiateAccess,
35 }
36
37 for _, key := range authenticateHeaders {
38 for value, expected := range tests {
39 res := &http.Response{Header: make(http.Header)}
40 res.Header.Set(key, value)
41 t.Logf("%s: %s", key, value)
42 result, _, _ := getAuthAccess(res, creds.NoneAccess, creds.AllAccessModes(), false)
43 assert.Equal(t, expected, result)
44 }
45 }
46}
47
48func TestDualAccessModes(t *testing.T) {
49 res := &http.Response{Header: make(http.Header)}

Callers

nothing calls this directly

Calls 5

AllAccessModesFunction · 0.92
getAuthAccessFunction · 0.85
LogfMethod · 0.80
SetMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected