Test case to show api build version using property file.
(t *testing.T)
| 353 | |
| 354 | // Test case to show api build version using property file. |
| 355 | func TestShowAPIBuildVersion(t *testing.T) { |
| 356 | common.CreateFile(tmpProp) |
| 357 | |
| 358 | os.Setenv("WSK_CONFIG_FILE", tmpProp) |
| 359 | assert.Equal(t, os.Getenv("WSK_CONFIG_FILE"), tmpProp, "The environment variable WSK_CONFIG_FILE has not been set.") |
| 360 | |
| 361 | stdout, err := wsk.RunCommand("property", "set", "--apihost", wsk.Wskprops.APIHost, |
| 362 | "--apiversion", wsk.Wskprops.Apiversion) |
| 363 | assert.Equal(t, nil, err, "The command property set --apihost --apiversion failed to run.") |
| 364 | stdout, err = wsk.RunCommand("property", "get", "-i", "--apibuild") |
| 365 | assert.Equal(t, nil, err, "The command property get -i --apibuild failed to run.") |
| 366 | println(common.RemoveRedundantSpaces(string(stdout))) |
| 367 | assert.NotContains(t, common.RemoveRedundantSpaces(string(stdout)), common.PropDisplayAPIBuild+" Unknown", |
| 368 | "The output of the command property get --apibuild does not contain "+common.PropDisplayAPIBuild+" Unknown") |
| 369 | assert.NotContains(t, common.RemoveRedundantSpaces(string(stdout)), "Unable to obtain API build information", |
| 370 | "The output of the command property get --apibuild does not contain \"Unable to obtain API build information\".") |
| 371 | assert.Contains(t, common.RemoveRedundantSpaces(string(stdout)), common.PropDisplayAPIBuild+" 20", |
| 372 | "The output of the command property get --apibuild does not contain"+common.PropDisplayAPIBuild+" 20") |
| 373 | common.DeleteFile(tmpProp) |
| 374 | } |
| 375 | |
| 376 | // Test case to fail to show api build when setting apihost to bogus value. |
| 377 | func TestFailShowAPIBuildVersion(t *testing.T) { |
nothing calls this directly
no test coverage detected