You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2017/11/25 01:51:41 UTC

[GitHub] rabbah commented on a change in pull request #2908: Optionally fetch code when getting an action

rabbah commented on a change in pull request #2908: Optionally fetch code when getting an action
URL: https://github.com/apache/incubator-openwhisk/pull/2908#discussion_r153035803
 
 

 ##########
 File path: tests/src/test/scala/whisk/core/controller/test/ActionsApiTests.scala
 ##########
 @@ -159,6 +159,22 @@ class ActionsApiTests extends ControllerTestCommon with WhiskActionsApi {
     }
   }
 
+  it should "get action using code query parameter" in {
+    implicit val tid = transid()
+    val action = WhiskAction(namespace, aname(), jsDefault("??"), Parameters("x", "b"))
+    put(entityStore, action)
+    Get(s"$collectionPath/${action.name}?code=false") ~> Route.seal(routes(creds)) ~> check {
+      status should be(OK)
+      val response = responseAs[JsObject]
+      response.fields("exec").asJsObject.fields should not(contain key "code")
+    }
+    Get(s"$collectionPath/${action.name}?code=true") ~> Route.seal(routes(creds)) ~> check {
+      status should be(OK)
+      val response = responseAs[JsObject]
+      response.fields("exec").asJsObject.fields("code") should be("??".toJson)
 
 Review comment:
   you could tighten both these tests with additional checks that the JSON response can be demarshaled to a `WhiskAction` or `WhiskActionMetadata` respectively and check for equality as well.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services