(t *testing.T)
| 918 | } |
| 919 | |
| 920 | func TestBasicAuthPasswordFile(t *testing.T) { |
| 921 | cfg, _, err := LoadHTTPConfigFile("testdata/http.conf.basic-auth.good.yaml") |
| 922 | require.NoErrorf(t, err, "Error loading HTTP client config: %v", err) |
| 923 | client, err := NewClientFromConfig(*cfg, "test") |
| 924 | require.NoErrorf(t, err, "Error creating HTTP Client: %v", err) |
| 925 | |
| 926 | rt, ok := client.Transport.(*basicAuthRoundTripper) |
| 927 | require.Truef(t, ok, "Error casting to basic auth transport, %v", client.Transport) |
| 928 | |
| 929 | if username, _ := rt.username.Fetch(context.Background()); username != "user" { |
| 930 | t.Errorf("Bad HTTP client username: %s", username) |
| 931 | } |
| 932 | if password, _ := rt.password.Fetch(context.Background()); password != "foobar" { |
| 933 | t.Errorf("Bad HTTP client password: %s", password) |
| 934 | } |
| 935 | } |
| 936 | |
| 937 | type secretManager struct { |
| 938 | data map[string]string |
nothing calls this directly
no test coverage detected
searching dependent graphs…