markusthoemmes commented on a change in pull request #3950: Extend system 
testsuite
URL: 
https://github.com/apache/incubator-openwhisk/pull/3950#discussion_r209898213
 
 

 ##########
 File path: tests/src/test/scala/whisk/core/cli/test/WskEntitlementTests.scala
 ##########
 @@ -160,6 +160,46 @@ abstract class WskEntitlementTests extends TestHelpers 
with WskTestHelpers with
     }
   }
 
+  it should "list shared packages when package is turned into public" in 
withAssetCleaner(guestWskProps) {
+    (wp, assetHelper) =>
+      assetHelper.withCleaner(wsk.pkg, samplePackage) { (pkg, _) =>
+        pkg.create(samplePackage)(wp)
+      }
+
+      retry {
+        val packageList = 
wsk.pkg.list(Some(s"/$guestNamespace"))(defaultWskProps)
+        verifyPackageNotSharedList(packageList, guestNamespace, samplePackage)
+      }
+
+      wsk.pkg.create(samplePackage, update = true, shared = Some(true))(wp)
+
+      retry {
+        val packageList = 
wsk.pkg.list(Some(s"/$guestNamespace"))(defaultWskProps)
+        verifyPackageSharedList(packageList, guestNamespace, samplePackage)
+      }
+  }
+
+  it should "not list any packages from invalid namespace" in 
withAssetCleaner(guestWskProps) { (wp, assetHelper) =>
+    val invalidNamespace = "whisk.systsdf"
+    retry {
+      val packageList = wsk.pkg.list(Some(s"/$invalidNamespace"))(wp)
+      packageList.stdout should be("[]") //empty list
+    }
+  }
+
+  it should "reject getting package from invalid namespace" in 
withAssetCleaner(guestWskProps) { (wp, assetHelper) =>
+    val invalidNamespace = "whisk.systsdf"
+    wsk.pkg.get(s"/${invalidNamespace}/utils", expectedExitCode = 
forbiddenCode)(wp).stderr should include(
+      "not authorized")
+  }
+
+  it should "reject getting invalid package from valid namespace" in 
withAssetCleaner(guestWskProps) {
+    (wp, assetHelper) =>
+      val invalidPackage = "utilssss"
+      wsk.pkg.get(s"/whisk.system/${invalidPackage}", expectedExitCode = 
forbiddenCode)(wp).stderr should include(
+        "not authorized")
+  }
 
 Review comment:
   I looked briefly into this. Ben's interface essentially needs an HttpRequest 
and its corresponding HttpResponse, both of which are available in the unit 
tests as well. @mgencur already opened an issue (#3959) to track that work. We 
agreed to defer that to a followup PR.

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