NO-ISSUE: tenancy authz - added PATCH cluster test
Added update cluster test to authz_test when org tenancy
is enabled - to ensure authorization for PATCH requests.
@@ -112,6 +112,12 @@ var _ = Describe("test authorization", func() {
Expect(err).ShouldNot(HaveOccurred())
})
+ It("can update cluster", func() {
+ _, err := editclusterUserBMClient.Installer.V2UpdateCluster(ctx, &installer.V2UpdateClusterParams{ClusterID: userClusterID,
+ ClusterUpdateParams: &models.V2ClusterUpdateParams{Name: swag.String("update-test")}})
+ Expect(err).ShouldNot(HaveOccurred())
+ })
+
It("can get bound infra-env", func() {
infraEnvID := registerInfraEnv(&userClusterID, models.ImageTypeMinimalIso).ID
_, err := editclusterUserBMClient.Installer.GetInfraEnv(ctx, &installer.GetInfraEnvParams{InfraEnvID: *infraEnvID})
@@ -167,6 +173,13 @@ var _ = Describe("test authorization", func() {
Expect(err).Should(HaveOccurred())
Expect(err).To(BeAssignableToTypeOf(installer.NewGetInfraEnvNotFound()))
})
+
+ It("can't update not owned cluster", func() {
+ _, err := userBMClient.Installer.V2UpdateCluster(ctx, &installer.V2UpdateClusterParams{ClusterID: userClusterID2,
+ ClusterUpdateParams: &models.V2ClusterUpdateParams{Name: swag.String("update-test")}})
+ Expect(err).Should(HaveOccurred())
+ Expect(err).To(BeAssignableToTypeOf(installer.NewV2UpdateClusterNotFound()))
+ })
})
Context("agent", func() {
