(t *testing.T)
| 993 | } |
| 994 | |
| 995 | func TestBasicUsernameFile(t *testing.T) { |
| 996 | cfg, _, err := LoadHTTPConfigFile("testdata/http.conf.basic-auth.username-file.good.yaml") |
| 997 | require.NoErrorf(t, err, "Error loading HTTP client config: %v", err) |
| 998 | client, err := NewClientFromConfig(*cfg, "test") |
| 999 | require.NoErrorf(t, err, "Error creating HTTP Client: %v", err) |
| 1000 | |
| 1001 | rt, ok := client.Transport.(*basicAuthRoundTripper) |
| 1002 | require.Truef(t, ok, "Error casting to basic auth transport, %v", client.Transport) |
| 1003 | |
| 1004 | if username, _ := rt.username.Fetch(context.Background()); username != "testuser" { |
| 1005 | t.Errorf("Bad HTTP client username: %s", username) |
| 1006 | } |
| 1007 | if password, _ := rt.password.Fetch(context.Background()); password != "foobar" { |
| 1008 | t.Errorf("Bad HTTP client passwordFile: %s", password) |
| 1009 | } |
| 1010 | } |
| 1011 | |
| 1012 | func getCertificateBlobs(t *testing.T) map[string][]byte { |
| 1013 | files := []string{ |
nothing calls this directly
no test coverage detected
searching dependent graphs…