Skip to content

Commit

Permalink
Add Test to Ensure Preservation of Annotations for Action Web Flag (#…
Browse files Browse the repository at this point in the history
…2366)

* Preserve Annotations for Action Web Flag
  • Loading branch information
dubee authored and Justin Berstler committed Jun 21, 2017
1 parent f25a8f1 commit b2e6a7d
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,40 @@ class WskBasicUsageTests
}
}

it should "ensure --web flag does not remove existing annotations" in withAssetCleaner(wskprops) {
(wp, assetHelper) =>
val name = "webaction"
val file = Some(TestUtils.getTestActionFilename("echo.js"))
val key = "someKey"
val value = JsString("someValue")
val annots = Map(key -> value)

assetHelper.withCleaner(wsk.action, name) {
(action, _) => action.create(name, file, annotations = annots)
}

wsk.action.create(name, file, web = Some("true"), update = true)

val stdout = wsk.action.get(name, fieldFilter = Some("annotations")).stdout
assert(stdout.startsWith(s"ok: got action $name, displaying field annotations\n"))
removeCLIHeader(stdout).parseJson shouldBe JsArray(
JsObject(
"key" -> JsString("web-export"),
"value" -> JsBoolean(true)),
JsObject(
"key" -> JsString("raw-http"),
"value" -> JsBoolean(false)),
JsObject(
"key" -> JsString("final"),
"value" -> JsBoolean(true)),
JsObject(
"key" -> JsString(key),
"value" -> value),
JsObject(
"key" -> JsString("exec"),
"value" -> JsString("nodejs:6")))
}

it should "reject action create and update with invalid web flag input" in withAssetCleaner(wskprops) {
(wp, assetHelper) =>
val name = "webaction"
Expand Down

0 comments on commit b2e6a7d

Please sign in to comment.