(t *testing.T)
| 901 | } |
| 902 | |
| 903 | func TestBasicAuthNoUsername(t *testing.T) { |
| 904 | cfg, _, err := LoadHTTPConfigFile("testdata/http.conf.basic-auth.no-username.yaml") |
| 905 | require.NoErrorf(t, err, "Error loading HTTP client config: %v", err) |
| 906 | client, err := NewClientFromConfig(*cfg, "test") |
| 907 | require.NoErrorf(t, err, "Error creating HTTP Client: %v", err) |
| 908 | |
| 909 | rt, ok := client.Transport.(*basicAuthRoundTripper) |
| 910 | require.Truef(t, ok, "Error casting to basic auth transport, %v", client.Transport) |
| 911 | |
| 912 | if rt.username != nil { |
| 913 | t.Errorf("Got unexpected username") |
| 914 | } |
| 915 | if password, _ := rt.password.Fetch(context.Background()); password != "secret" { |
| 916 | t.Errorf("Unexpected HTTP client password: %s", password) |
| 917 | } |
| 918 | } |
| 919 | |
| 920 | func TestBasicAuthPasswordFile(t *testing.T) { |
| 921 | cfg, _, err := LoadHTTPConfigFile("testdata/http.conf.basic-auth.good.yaml") |
nothing calls this directly
no test coverage detected
searching dependent graphs…