MCPcopy Index your code
hub / github.com/tinyauthapp/tinyauth / TestGetBasicAuth

Function TestGetBasicAuth

internal/utils/security_utils_test.go:58–76  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

56}
57
58func TestGetBasicAuth(t *testing.T) {
59 // Normal case
60 username := "user"
61 password := "pass"
62 expected := "dXNlcjpwYXNz" // base64 of "user:pass"
63 assert.Equal(t, expected, utils.GetBasicAuth(username, password))
64
65 // Empty username
66 username = ""
67 password = "pass"
68 expected = "OnBhc3M=" // base64 of ":pass"
69 assert.Equal(t, expected, utils.GetBasicAuth(username, password))
70
71 // Empty password
72 username = "user"
73 password = ""
74 expected = "dXNlcjo=" // base64 of "user:"
75 assert.Equal(t, expected, utils.GetBasicAuth(username, password))
76}
77
78func TestFilterIP(t *testing.T) {
79 // Exact match IPv4

Callers

nothing calls this directly

Calls 1

GetBasicAuthFunction · 0.92

Tested by

no test coverage detected