Test case to reject commands that are executed with invalid arguments.
(t *testing.T)
| 431 | |
| 432 | // Test case to reject commands that are executed with invalid arguments. |
| 433 | func TestRejectCommInvalidArgs(t *testing.T) { |
| 434 | initInvalidArgs() |
| 435 | for _, invalidArg := range invalidArgs { |
| 436 | cs := invalidArg.Cmd |
| 437 | cs = append(cs, "--apihost", wsk.Wskprops.APIHost) |
| 438 | stdout, err := wsk.RunCommand(cs...) |
| 439 | outputString := string(stdout) |
| 440 | assert.NotEqual(t, nil, err, "The command should fail to run.") |
| 441 | if err.Error() == "exit status 1" { |
| 442 | assert.Equal(t, "exit status 1", err.Error(), "The error should be exit status 1 or 2.") |
| 443 | } else { |
| 444 | assert.Equal(t, "exit status 2", err.Error(), "The error should be exit status 1 or 2.") |
| 445 | } |
| 446 | assert.Contains(t, outputString, invalidArg.Err, |
| 447 | "The output of the command does not contain "+invalidArg.Err) |
| 448 | assert.Contains(t, outputString, "Run 'wsk --help' for usage", |
| 449 | "The output of the command does not contain \"Run 'wsk --help' for usage\".") |
| 450 | } |
| 451 | } |
| 452 | |
| 453 | // Test case to reject commands that are executed with invalid JSON for annotations and parameters. |
| 454 | func TestRejectCommInvalidJSON(t *testing.T) { |
nothing calls this directly
no test coverage detected