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

Function TestValidateDefaultProperties

tests/src/integration/command_test.go:98–125  ·  view source on GitHub ↗

Test case to validate default property values.

(t *testing.T)

Source from the content-addressed store, hash-verified

96
97// Test case to validate default property values.
98func TestValidateDefaultProperties(t *testing.T) {
99 common.CreateFile(tmpProp)
100
101 os.Setenv("WSK_CONFIG_FILE", tmpProp)
102 assert.Equal(t, os.Getenv("WSK_CONFIG_FILE"), tmpProp, "The environment variable WSK_CONFIG_FILE has not been set.")
103
104 stdout, err := wsk.RunCommand("property", "unset", "--auth", "--apihost", "--apiversion")
105 assert.Equal(t, nil, err, "The command property unset failed to run.")
106 outputString := string(stdout)
107 assert.Contains(t, outputString, "ok: whisk auth unset",
108 "The output of the command does not contain \"ok: whisk auth unset\".")
109 assert.Contains(t, outputString, "ok: whisk API host unset",
110 "The output of the command does not contain \"ok: whisk API host unset\".")
111 assert.Contains(t, outputString, "ok: whisk API version unset",
112 "The output of the command does not contain \"ok: whisk API version unset\".")
113
114 stdout, err = wsk.RunCommand("property", "get", "--auth")
115 assert.Equal(t, nil, err, "The command property get --auth failed to run.")
116 assert.Equal(t, common.PropDisplayAuth, common.RemoveRedundantSpaces(string(stdout)),
117 "The output of the command does not equal to "+common.PropDisplayAuth)
118
119 stdout, err = wsk.RunCommand("property", "get", "--apihost")
120 assert.Equal(t, nil, err, "The command property get --apihost failed to run.")
121 assert.Equal(t, common.PropDisplayAPIHost, common.RemoveRedundantSpaces(string(stdout)),
122 "The output of the command does not equal to "+common.PropDisplayAPIHost)
123
124 common.DeleteFile(tmpProp)
125}
126
127// Test case to set auth in property file.
128func TestSetAuth(t *testing.T) {

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