(t *testing.T)
| 958 | } |
| 959 | |
| 960 | func TestBasicUsernameFile(t *testing.T) { |
| 961 | cfg, _, err := LoadHTTPConfigFile("testdata/http.conf.basic-auth.username-file.good.yaml") |
| 962 | if err != nil { |
| 963 | t.Fatalf("Error loading HTTP client config: %v", err) |
| 964 | } |
| 965 | client, err := NewClientFromConfig(*cfg, "test") |
| 966 | if err != nil { |
| 967 | t.Fatalf("Error creating HTTP Client: %v", err) |
| 968 | } |
| 969 | |
| 970 | rt, ok := client.Transport.(*basicAuthRoundTripper) |
| 971 | if !ok { |
| 972 | t.Fatalf("Error casting to basic auth transport, %v", client.Transport) |
| 973 | } |
| 974 | |
| 975 | if rt.username != "" { |
| 976 | t.Errorf("Bad HTTP client username: %s", rt.username) |
| 977 | } |
| 978 | if string(rt.usernameFile) != "testdata/basic-auth-username" { |
| 979 | t.Errorf("Bad HTTP client usernameFile: %s", rt.usernameFile) |
| 980 | } |
| 981 | if string(rt.passwordFile) != "testdata/basic-auth-password" { |
| 982 | t.Errorf("Bad HTTP client passwordFile: %s", rt.passwordFile) |
| 983 | } |
| 984 | } |
| 985 | |
| 986 | func getCertificateBlobs(t *testing.T) map[string][]byte { |
| 987 | files := []string{ |
nothing calls this directly
no test coverage detected