Test case to reject a command when the API host is not set.
(t *testing.T)
| 173 | |
| 174 | // Test case to reject a command when the API host is not set. |
| 175 | func TestRejectCommAPIHostNotSet(t *testing.T) { |
| 176 | common.CreateFile(tmpProp) |
| 177 | |
| 178 | os.Setenv("WSK_CONFIG_FILE", tmpProp) |
| 179 | assert.Equal(t, os.Getenv("WSK_CONFIG_FILE"), tmpProp, "The environment variable WSK_CONFIG_FILE has not been set.") |
| 180 | |
| 181 | stdout, err := wsk.RunCommand("property", "get") |
| 182 | assert.NotEqual(t, nil, err, "The command property get --apihost --apiversion should fail to run.") |
| 183 | assert.Contains(t, common.RemoveRedundantSpaces(string(stdout)), |
| 184 | "The API host is not valid: An API host must be provided", |
| 185 | "The output of the command does not contain \"The API host is not valid: An API host must be provided\".") |
| 186 | common.DeleteFile(tmpProp) |
| 187 | } |
| 188 | |
| 189 | func initInvalidArgsNotEnoughParamsArgs() { |
| 190 | invalidArgs = []common.InvalidArg{ |
nothing calls this directly
no test coverage detected