(t *testing.T)
| 932 | } |
| 933 | |
| 934 | func TestBasicAuthPasswordFile(t *testing.T) { |
| 935 | cfg, _, err := LoadHTTPConfigFile("testdata/http.conf.basic-auth.good.yaml") |
| 936 | if err != nil { |
| 937 | t.Fatalf("Error loading HTTP client config: %v", err) |
| 938 | } |
| 939 | client, err := NewClientFromConfig(*cfg, "test") |
| 940 | if err != nil { |
| 941 | t.Fatalf("Error creating HTTP Client: %v", err) |
| 942 | } |
| 943 | |
| 944 | rt, ok := client.Transport.(*basicAuthRoundTripper) |
| 945 | if !ok { |
| 946 | t.Fatalf("Error casting to basic auth transport, %v", client.Transport) |
| 947 | } |
| 948 | |
| 949 | if rt.username != "user" { |
| 950 | t.Errorf("Bad HTTP client username: %s", rt.username) |
| 951 | } |
| 952 | if string(rt.password) != "" { |
| 953 | t.Errorf("Bad HTTP client password: %s", rt.password) |
| 954 | } |
| 955 | if string(rt.passwordFile) != "testdata/basic-auth-password" { |
| 956 | t.Errorf("Bad HTTP client passwordFile: %s", rt.passwordFile) |
| 957 | } |
| 958 | } |
| 959 | |
| 960 | func TestBasicUsernameFile(t *testing.T) { |
| 961 | cfg, _, err := LoadHTTPConfigFile("testdata/http.conf.basic-auth.username-file.good.yaml") |
nothing calls this directly
no test coverage detected