dubeejw commented on a change in pull request #2621: Replace the test cases of 
action and package with REST implementation
URL: 
https://github.com/apache/incubator-openwhisk/pull/2621#discussion_r146338270
 
 

 ##########
 File path: tests/src/test/scala/common/WskTestHelpers.scala
 ##########
 @@ -280,9 +280,13 @@ trait WskTestHelpers extends Matchers {
     }
   }
 
-  def removeCLIHeader(response: String): String = 
response.substring(response.indexOf("\n"))
+  def removeCLIHeader(response: String): String = {
+    if (response.contains("\n")) response.substring(response.indexOf("\n")) 
else response
+  }
 
-  def getJSONFromCLIResponse(response: String): JsObject = 
removeCLIHeader(response).parseJson.asJsObject
+  def getJSONFromResponse(response: String, isCli: Boolean = false): JsObject 
= {
+    if (isCli) removeCLIHeader(response).parseJson.asJsObject else 
response.parseJson.asJsObject
 
 Review comment:
   Ah, I see. The newline from the REST call might be anywhere in the output.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to