You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by cs...@apache.org on 2017/06/26 15:59:46 UTC
[incubator-openwhisk-cli] 06/36: Add Web Action Shortcuts to CLI
This is an automated email from the ASF dual-hosted git repository.
csantanapr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-cli.git
commit c46499344b02aa9e058583f0bf85d3ac10efd393
Author: dubeejw <jw...@us.ibm.com>
AuthorDate: Tue Mar 14 15:22:06 2017 -0400
Add Web Action Shortcuts to CLI
Usage: `--web (true|yes)|raw|(false|no)`
---
.../whisk/core/cli/test/WskBasicUsageTests.scala | 44 ++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala b/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala
index e421df8..de81b29 100644
--- a/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala
+++ b/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala
@@ -557,6 +557,50 @@ class WskBasicUsageTests
}
}
+ it should "ensure --web flags set the proper annotations" in withAssetCleaner(wskprops) {
+ (wp, assetHelper) =>
+ val name = "webaction"
+ val file = Some(TestUtils.getTestActionFilename("echo.js"))
+
+ assetHelper.withCleaner(wsk.action, name) {
+ (action, _) => action.create(name, file)
+ }
+
+ Seq("true", "faLse", "tRue", "nO", "yEs", "no", "raw", "NO", "Raw").
+ foreach { flag =>
+ val webEnabled = flag.toLowerCase == "true" || flag.toLowerCase == "yes"
+ val rawEnabled = flag.toLowerCase == "raw"
+
+ wsk.action.create(name, file, web = Some(flag), 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(webEnabled || rawEnabled)),
+ JsObject(
+ "key" -> JsString("raw-http"),
+ "value" -> JsBoolean(rawEnabled)),
+ JsObject(
+ "key" -> JsString("final"),
+ "value" -> JsBoolean(webEnabled || rawEnabled)),
+ 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"
+ val file = Some(TestUtils.getTestActionFilename("echo.js"))
+ val invalidInput = "bogus"
+ val errorMsg = s"Invalid argument '$invalidInput' for --web flag. Valid input consist of 'yes', 'true', 'raw', 'false', or 'no'."
+ wsk.action.create(name, file, web = Some(invalidInput), expectedExitCode = ERROR_EXIT).stderr should include(errorMsg)
+ wsk.action.create(name, file, web = Some(invalidInput), update = true, expectedExitCode = ERROR_EXIT).stderr should include(errorMsg)
+ }
+
behavior of "Wsk packages"
it should "create, and delete a package" in {
--
To stop receiving notification emails like this one, please contact
"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>.