MCPcopy Create free account
hub / github.com/apache/openwhisk-cli / TestRejectCommAPIHostNotSet

Function TestRejectCommAPIHostNotSet

tests/src/integration/command_test.go:175–187  ·  view source on GitHub ↗

Test case to reject a command when the API host is not set.

(t *testing.T)

Source from the content-addressed store, hash-verified

173
174// Test case to reject a command when the API host is not set.
175func 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
189func initInvalidArgsNotEnoughParamsArgs() {
190 invalidArgs = []common.InvalidArg{

Callers

nothing calls this directly

Calls 4

CreateFileFunction · 0.92
RemoveRedundantSpacesFunction · 0.92
DeleteFileFunction · 0.92
RunCommandMethod · 0.80

Tested by

no test coverage detected