openwhisk-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rab...@apache.org
Subject [incubator-openwhisk] branch master updated: Increase test coverage for JSON values as web action body arguments (#2778)
Date Fri, 22 Sep 2017 11:28:01 GMT
This is an automated email from the ASF dual-hosted git repository.

rabbah pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git


The following commit(s) were added to refs/heads/master by this push:
     new 354d9ea  Increase test coverage for JSON values as web action body arguments (#2778)
354d9ea is described below

commit 354d9eaecddd965c6bc6748cd9f4832d2de18241
Author: James Dubee <jwdubee@us.ibm.com>
AuthorDate: Fri Sep 22 06:27:58 2017 -0500

    Increase test coverage for JSON values as web action body arguments (#2778)
---
 .../core/controller/test/WebActionsApiTests.scala  | 24 ++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/tests/src/test/scala/whisk/core/controller/test/WebActionsApiTests.scala b/tests/src/test/scala/whisk/core/controller/test/WebActionsApiTests.scala
index ed44fe2..3879c80 100644
--- a/tests/src/test/scala/whisk/core/controller/test/WebActionsApiTests.scala
+++ b/tests/src/test/scala/whisk/core/controller/test/WebActionsApiTests.scala
@@ -1620,6 +1620,30 @@ trait WebActionsApiBaseTests extends ControllerTestCommon with BeforeAndAfterEac
         invocationsAllowed shouldBe invocationCount
       }
     }
+
+    it should s"invoke web action ensuring JSON value body arguments are not Base64 encoded
(auth? ${creds.isDefined})" in {
+      implicit val tid = transid()
+
+      Seq("this is a string".toJson, JsArray(1.toJson, "str str".toJson, false.toJson), true.toJson,
99.toJson)
+        .foreach { str =>
+          invocationsAllowed += 1
+          Post(
+            s"$testRoutePath/$systemId/proxy/export_c.json",
+            HttpEntity(ContentTypes.`application/json`, str.compactPrint)) ~> Route.seal(routes(creds))
~> check {
+            status should be(OK)
+            val response = responseAs[JsObject]
+            response shouldBe JsObject(
+              "pkg" -> s"$systemId/proxy".toJson,
+              "action" -> "export_c".toJson,
+              "content" -> metaPayload(
+                Post.method.name.toLowerCase,
+                Map(webApiDirectives.body -> str).toJson.asJsObject,
+                creds,
+                pkgName = "proxy",
+                headers = List(`Content-Type`(ContentTypes.`application/json`))))
+          }
+        }
+    }
   }
 
   class TestingEntitlementProvider(config: WhiskConfig, loadBalancer: LoadBalancer)

-- 
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" <commits@openwhisk.apache.org>'].

Mime
View raw message