houshengbo 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_r146311845
 
 

 ##########
 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:
   Since the Cli tests will still exist for some time, we need to make sure Cli 
tests also pass.
   Response of rest may contain "\n" as well, but we cannot remove it.

----------------------------------------------------------------
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