dubeejw commented on a change in pull request #223: Sync tests
URL: 
https://github.com/apache/incubator-openwhisk-cli/pull/223#discussion_r168638754
 
 

 ##########
 File path: tests/src/test/scala/system/basic/WskBasicTests.scala
 ##########
 @@ -464,34 +470,67 @@ class WskBasicTests extends TestHelpers with 
WskTestHelpers {
   behavior of "Wsk Trigger CLI"
 
   it should "create, update, get, fire and list trigger" in 
withAssetCleaner(wskprops) { (wp, assetHelper) =>
-    val name = "listTriggers"
+    val ruleName = withTimestamp("r1toa1")
+    val triggerName = withTimestamp("t1tor1")
+    val actionName = withTimestamp("a1")
     val params = Map("a" -> "A".toJson)
-    assetHelper.withCleaner(wsk.trigger, name) { (trigger, _) =>
-      trigger.create(name, parameters = params)
-      trigger.create(name, update = true)
+    val ns = wsk.namespace.whois()
+
+    assetHelper.withCleaner(wsk.trigger, triggerName) { (trigger, _) =>
+      trigger.create(triggerName, parameters = params)
+      trigger.create(triggerName, update = true)
+    }
+
+    assetHelper.withCleaner(wsk.action, actionName) { (action, name) =>
+      action.create(name, defaultAction)
+    }
+
+    assetHelper.withCleaner(wsk.rule, ruleName) { (rule, name) =>
+      rule.create(name, trigger = triggerName, action = actionName)
     }
-    val stdout = wsk.trigger.get(name).stdout
-    stdout should include regex (""""key": "a"""")
-    stdout should include regex (""""value": "A"""")
-    stdout should include regex (""""publish": false""")
-    stdout should include regex (""""version": "0.0.2"""")
+
+    val trigger = wsk.trigger.get(triggerName)
+    getJSONFromResponse(trigger.stdout, true).fields("parameters") shouldBe 
JsArray(JsObject("key" -> JsString("a"), "value" -> JsString("A")))
+    getJSONFromResponse(trigger.stdout, true).fields("publish") shouldBe 
false.toJson
+    getJSONFromResponse(trigger.stdout, true).fields("version") shouldBe 
"0.0.2".toJson
+
+    val expectedRules = JsObject(
+      ns + "/" + ruleName -> JsObject(
+        "action" -> JsObject("name" -> JsString(actionName), "path" -> 
JsString(ns)),
+        "status" -> JsString("active")))
+
+    // getJSONFromResponse(trigger.stdout, true).fields("rules") shouldBe 
expectedRules
 
 Review comment:
   Disable this check until the CLI is updated to list rules from a trigger 
view.

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