(t *testing.T)
| 56 | } |
| 57 | |
| 58 | func 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 | |
| 78 | func TestFilterIP(t *testing.T) { |
| 79 | // Exact match IPv4 |
nothing calls this directly
no test coverage detected