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

 ##########
 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:
   Should all of these be moved to `PackagesApiTests.scala`?
   
   EDIT: After a discussion via Slack, we agreed to keep these in here for the 
moment since they revealed missing pieces in the swagger documentation.
   
   Does this only apply to the last two? Could we move the first ones to the 
API-level test and keep the others in here leaving a TODO to move once the 
API-level tests can validate swagger conformity 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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to