summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-08-04 09:36:59 +0000
committerGerrit Code Review <review@openstack.org>2017-08-04 09:37:00 +0000
commit16c1d86c1e6a7b099c818b924b52d043b1dc7e09 (patch)
treec0fa82c0ce4c9654765c8f3400137b8bbb93f802
parent86697ef86ea92558aaa31a3576ac0f7fe09d70ef (diff)
parent87051a72f5e6520775ce620c4b180b5059592c2f (diff)
Merge "Added Tempest tests for publicizing a package"4.0.0.0rc1
-rw-r--r--murano_tempest_tests/tests/api/application_catalog/test_repository.py34
-rw-r--r--murano_tempest_tests/tests/api/application_catalog/test_repository_negative.py28
2 files changed, 62 insertions, 0 deletions
diff --git a/murano_tempest_tests/tests/api/application_catalog/test_repository.py b/murano_tempest_tests/tests/api/application_catalog/test_repository.py
index 54ff7f7..a8494f2 100644
--- a/murano_tempest_tests/tests/api/application_catalog/test_repository.py
+++ b/murano_tempest_tests/tests/api/application_catalog/test_repository.py
@@ -178,6 +178,40 @@ class TestRepository(base.BaseApplicationCatalogIsolatedAdminTest):
178 def test_download_package(self): 178 def test_download_package(self):
179 self.application_catalog_client.download_package(self.package['id']) 179 self.application_catalog_client.download_package(self.package['id'])
180 180
181 @decorators.attr(type='smoke')
182 @decorators.idempotent_id('9e55ae34-dea4-4db5-be4a-b3b793c9c4a7')
183 def test_publicize_package(self):
184 # Given a package that isn't public
185 application_name = utils.generate_name('test_publicize_package')
186 abs_archive_path, dir_with_archive, archive_name = \
187 utils.prepare_package(application_name)
188 self.addCleanup(os.remove, abs_archive_path)
189 package = self.application_catalog_client.upload_package(
190 application_name, archive_name, dir_with_archive,
191 {"categories": [], "tags": [], 'is_public': False})
192 self.addCleanup(self.application_catalog_client.delete_package,
193 package['id'])
194
195 fetched_package = self.application_catalog_client.get_package(
196 package['id'])
197 self.assertFalse(fetched_package['is_public'])
198
199 # When package is publicized
200 post_body = [
201 {
202 "op": "replace",
203 "path": "/is_public",
204 "value": True
205 }
206 ]
207 self.application_catalog_client.update_package(package['id'],
208 post_body)
209
210 # Then package becomes public
211 fetched_package = self.application_catalog_client.get_package(
212 package['id'])
213 self.assertTrue(fetched_package['is_public'])
214
181 @decorators.idempotent_id('1c017c1b-9efc-4498-95ff-833a9ce565a0') 215 @decorators.idempotent_id('1c017c1b-9efc-4498-95ff-833a9ce565a0')
182 def test_get_ui_definitions(self): 216 def test_get_ui_definitions(self):
183 self.application_catalog_client.get_ui_definition(self.package['id']) 217 self.application_catalog_client.get_ui_definition(self.package['id'])
diff --git a/murano_tempest_tests/tests/api/application_catalog/test_repository_negative.py b/murano_tempest_tests/tests/api/application_catalog/test_repository_negative.py
index 98d5cdc..12d3af1 100644
--- a/murano_tempest_tests/tests/api/application_catalog/test_repository_negative.py
+++ b/murano_tempest_tests/tests/api/application_catalog/test_repository_negative.py
@@ -163,3 +163,31 @@ class TestRepositoryNegativeForbidden(base.BaseApplicationCatalogTest):
163 self.assertRaises(exceptions.Forbidden, 163 self.assertRaises(exceptions.Forbidden,
164 self.alt_client.get_logo, 164 self.alt_client.get_logo,
165 self.package['id']) 165 self.package['id'])
166
167 @decorators.attr(type='negative')
168 @decorators.idempotent_id('12928ec7-bd31-415d-9260-5c488aebd4c7')
169 def test_publicize_package_as_non_admin_user(self):
170 # Given a package that isn't public
171 application_name = utils.generate_name('test_publicize_package_'
172 'as_non_admin_user')
173 abs_archive_path, dir_with_archive, archive_name = \
174 utils.prepare_package(application_name)
175 self.addCleanup(os.remove, abs_archive_path)
176 package = self.application_catalog_client.upload_package(
177 application_name, archive_name, dir_with_archive,
178 {"categories": [], "tags": [], 'is_public': False})
179 self.addCleanup(self.application_catalog_client.delete_package,
180 package['id'])
181
182 # When package is publicized, then the method throws an exception
183 post_body = [
184 {
185 "op": "replace",
186 "path": "/is_public",
187 "value": True
188 }
189 ]
190 self.assertRaises(exceptions.Forbidden,
191 self.application_catalog_client.update_package,
192 package['id'],
193 post_body)