Do not allow to modify access for public share type
Now public share type can be removed project access, but when
listing access, manila returns 'Access list not available for public
share types'. It's weird for users experience.
We should check if a type is public and do not allow public share type
to modify project access.
APIImpact
When modifying access for public share type, API will return 409 and message:
"Invalid share type: Type access modification is not applicable to public
share type."
Change-Id: I94f580eeb7eef4263c631227cc3710eeae2b9706
Closes-Bug: #1490912
diff --git a/manila_tempest_tests/tests/api/admin/test_share_types_negative.py b/manila_tempest_tests/tests/api/admin/test_share_types_negative.py
index 62e4523..32c9620 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_types_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_types_negative.py
@@ -68,3 +68,33 @@
self.create_share_type,
st["share_type"]["name"],
extra_specs=self.add_required_extra_specs_to_dict())
+
+ @test.attr(type=["gate", "smoke", ])
+ def test_add_share_type_allowed_for_public(self):
+ st = self._create_share_type()
+ self.assertRaises(lib_exc.Conflict,
+ self.shares_client.add_access_to_share_type,
+ st["share_type"]["id"],
+ self.shares_client.tenant_id)
+
+ @test.attr(type=["gate", "smoke", ])
+ def test_remove_share_type_allowed_for_public(self):
+ st = self._create_share_type()
+ self.assertRaises(lib_exc.Conflict,
+ self.shares_client.remove_access_from_share_type,
+ st["share_type"]["id"],
+ self.shares_client.tenant_id)
+
+ @test.attr(type=["gate", "smoke", ])
+ def test_add_share_type_by_nonexistent_id(self):
+ self.assertRaises(lib_exc.NotFound,
+ self.shares_client.add_access_to_share_type,
+ data_utils.rand_name("fake"),
+ self.shares_client.tenant_id)
+
+ @test.attr(type=["gate", "smoke", ])
+ def test_remove_share_type_by_nonexistent_id(self):
+ self.assertRaises(lib_exc.NotFound,
+ self.shares_client.remove_access_from_share_type,
+ data_utils.rand_name("fake"),
+ self.shares_client.tenant_id)