(t *testing.T)
| 880 | } |
| 881 | |
| 882 | func TestBasicAuthNoPassword(t *testing.T) { |
| 883 | cfg, _, err := LoadHTTPConfigFile("testdata/http.conf.basic-auth.no-password.yaml") |
| 884 | if err != nil { |
| 885 | t.Fatalf("Error loading HTTP client config: %v", err) |
| 886 | } |
| 887 | client, err := NewClientFromConfig(*cfg, "test") |
| 888 | if err != nil { |
| 889 | t.Fatalf("Error creating HTTP Client: %v", err) |
| 890 | } |
| 891 | |
| 892 | rt, ok := client.Transport.(*basicAuthRoundTripper) |
| 893 | if !ok { |
| 894 | t.Fatalf("Error casting to basic auth transport, %v", client.Transport) |
| 895 | } |
| 896 | |
| 897 | if rt.username != "user" { |
| 898 | t.Errorf("Bad HTTP client username: %s", rt.username) |
| 899 | } |
| 900 | if string(rt.password) != "" { |
| 901 | t.Errorf("Expected empty HTTP client password: %s", rt.password) |
| 902 | } |
| 903 | if string(rt.passwordFile) != "" { |
| 904 | t.Errorf("Expected empty HTTP client passwordFile: %s", rt.passwordFile) |
| 905 | } |
| 906 | } |
| 907 | |
| 908 | func TestBasicAuthNoUsername(t *testing.T) { |
| 909 | cfg, _, err := LoadHTTPConfigFile("testdata/http.conf.basic-auth.no-username.yaml") |
nothing calls this directly
no test coverage detected