Test case to reject bad command.
(t *testing.T)
| 414 | |
| 415 | // Test case to reject bad command. |
| 416 | func TestRejectAuthCommNoKey(t *testing.T) { |
| 417 | common.CreateFile(tmpProp) |
| 418 | |
| 419 | os.Setenv("WSK_CONFIG_FILE", tmpProp) |
| 420 | assert.Equal(t, os.Getenv("WSK_CONFIG_FILE"), tmpProp, "The environment variable WSK_CONFIG_FILE has not been set.") |
| 421 | |
| 422 | stdout, err := wsk.RunCommand("list", "--apihost", wsk.Wskprops.APIHost, |
| 423 | "--apiversion", wsk.Wskprops.Apiversion) |
| 424 | assert.NotEqual(t, nil, err, "The command list should fail to run.") |
| 425 | assert.Contains(t, common.RemoveRedundantSpaces(string(stdout)), "usage.", |
| 426 | "The output of the command does not contain \"usage.\".") |
| 427 | assert.Contains(t, common.RemoveRedundantSpaces(string(stdout)), "--auth is required", |
| 428 | "The output of the command does not contain \"--auth is required\".") |
| 429 | common.DeleteFile(tmpProp) |
| 430 | } |
| 431 | |
| 432 | // Test case to reject commands that are executed with invalid arguments. |
| 433 | func TestRejectCommInvalidArgs(t *testing.T) { |
nothing calls this directly
no test coverage detected