shared resource permission ut
@@ -5,14 +5,15 @@ import org.zstack.header.identity.AccountConstant
import org.zstack.header.vm.VmInstanceState
import org.zstack.header.vm.VmInstanceVO
import org.zstack.sdk.AccountInventory
+import org.zstack.sdk.ImageInventory
import org.zstack.sdk.InstanceOfferingInventory
import org.zstack.sdk.SessionInventory
+import org.zstack.sdk.UpdateInstanceOfferingAction
import org.zstack.sdk.VmInstanceInventory
import org.zstack.test.integration.ZStackTest
import org.zstack.test.integration.identity.Env
import org.zstack.testlib.EnvSpec
import org.zstack.testlib.SubCase
-
/**
* Created by camile on 2017/6/11.
*/
@@ -63,14 +64,32 @@ class OperationResourceCase extends SubCase {
accountUuids = [accountInventory.uuid]
}
- shareResource {
+ revokeResourceSharing{
resourceUuids = [instanceOfferingInventory.uuid]
accountUuids = [accountInventory.uuid]
}
- revokeResourceSharing{
- resourceUuids = [instanceOfferingInventory.uuid]
+ }
+
+ void testSharedResourceOperator() {
+ def instanceOfferingInventory = envSpec.inventoryByName("instanceOffering") as InstanceOfferingInventory
+ def image = envSpec.inventoryByName("image1") as ImageInventory
+ shareResource {
+ resourceUuids = [instanceOfferingInventory.uuid, image.uuid]
accountUuids = [accountInventory.uuid]
}
+ logOut {
+ sessionUuid = adminSession()
+ }
+
+ def session = logInByAccount {
+ accountName = "test"
+ password = "password"
+ } as SessionInventory
+ def action = new UpdateInstanceOfferingAction()
+ action.sessionId = session.uuid
+ action.uuid = instanceOfferingInventory.uuid
+ action.name = "updated"
+ assert action.call().error != null
}
@Override
@@ -78,6 +97,7 @@ class OperationResourceCase extends SubCase {
envSpec.create {
testChangeOwnerWhenVMStarting()
testShareResourceAgain()
+ testSharedResourceOperator()
}
}
}
