(t *testing.T)
| 271 | } |
| 272 | |
| 273 | func TestBasicAuthData(t *testing.T) { |
| 274 | username := "myuser" |
| 275 | password := "mypass" |
| 276 | |
| 277 | config := clientcmdapi.NewConfig() |
| 278 | config.Clusters["clean"] = &clientcmdapi.Cluster{ |
| 279 | Server: "https://localhost:8443", |
| 280 | } |
| 281 | config.AuthInfos["clean"] = &clientcmdapi.AuthInfo{ |
| 282 | Username: username, |
| 283 | Password: password, |
| 284 | } |
| 285 | config.Contexts["clean"] = &clientcmdapi.Context{ |
| 286 | Cluster: "clean", |
| 287 | AuthInfo: "clean", |
| 288 | } |
| 289 | config.CurrentContext = "clean" |
| 290 | |
| 291 | clientBuilder := NewNonInteractiveClientConfig(*config, "clean", &ConfigOverrides{}, nil) |
| 292 | |
| 293 | clientConfig, err := clientBuilder.ClientConfig() |
| 294 | if err != nil { |
| 295 | t.Fatalf("Unexpected error: %v", err) |
| 296 | } |
| 297 | |
| 298 | // Make sure basic auth data gets into config |
| 299 | matchStringArg(username, clientConfig.Username, t) |
| 300 | matchStringArg(password, clientConfig.Password, t) |
| 301 | } |
| 302 | |
| 303 | func TestBasicTokenFile(t *testing.T) { |
| 304 | token := "exampletoken" |
nothing calls this directly
no test coverage detected