(t *testing.T)
| 906 | } |
| 907 | |
| 908 | func TestBasicAuthNoUsername(t *testing.T) { |
| 909 | cfg, _, err := LoadHTTPConfigFile("testdata/http.conf.basic-auth.no-username.yaml") |
| 910 | if err != nil { |
| 911 | t.Fatalf("Error loading HTTP client config: %v", err) |
| 912 | } |
| 913 | client, err := NewClientFromConfig(*cfg, "test") |
| 914 | if err != nil { |
| 915 | t.Fatalf("Error creating HTTP Client: %v", err) |
| 916 | } |
| 917 | |
| 918 | rt, ok := client.Transport.(*basicAuthRoundTripper) |
| 919 | if !ok { |
| 920 | t.Fatalf("Error casting to basic auth transport, %v", client.Transport) |
| 921 | } |
| 922 | |
| 923 | if rt.username != "" { |
| 924 | t.Errorf("Got unexpected username: %s", rt.username) |
| 925 | } |
| 926 | if string(rt.password) != "secret" { |
| 927 | t.Errorf("Unexpected HTTP client password: %s", string(rt.password)) |
| 928 | } |
| 929 | if string(rt.passwordFile) != "" { |
| 930 | t.Errorf("Expected empty HTTP client passwordFile: %s", rt.passwordFile) |
| 931 | } |
| 932 | } |
| 933 | |
| 934 | func TestBasicAuthPasswordFile(t *testing.T) { |
| 935 | cfg, _, err := LoadHTTPConfigFile("testdata/http.conf.basic-auth.good.yaml") |
nothing calls this directly
no test coverage detected