Add repository API tests
Change-Id: I7cd0e2f6164facf70a9ffce56dc215955a82be83
This commit is contained in:
parent
dbc6843148
commit
cd62190c35
@ -4,33 +4,20 @@ if is_service_enabled murano; then
|
|||||||
if [[ "$1" == "source" ]]; then
|
if [[ "$1" == "source" ]]; then
|
||||||
# Initial source
|
# Initial source
|
||||||
source $TOP_DIR/lib/murano
|
source $TOP_DIR/lib/murano
|
||||||
source $TOP_DIR/lib/murano-dashboard
|
|
||||||
elif [[ "$1" == "stack" && "$2" == "install" ]]; then
|
elif [[ "$1" == "stack" && "$2" == "install" ]]; then
|
||||||
echo_summary "Installing Murano"
|
echo_summary "Installing Murano"
|
||||||
install_murano
|
install_murano
|
||||||
if is_service_enabled horizon; then
|
|
||||||
install_murano_dashboard
|
|
||||||
fi
|
|
||||||
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
|
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
|
||||||
echo_summary "Configuring Murano"
|
echo_summary "Configuring Murano"
|
||||||
configure_murano
|
configure_murano
|
||||||
create_murano_accounts
|
create_murano_accounts
|
||||||
if is_service_enabled horizon; then
|
|
||||||
configure_murano_dashboard
|
|
||||||
fi
|
|
||||||
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
|
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
|
||||||
echo_summary "Initializing Murano"
|
echo_summary "Initializing Murano"
|
||||||
init_murano
|
init_murano
|
||||||
if is_service_enabled horizon; then
|
|
||||||
init_murano_dashboard
|
|
||||||
fi
|
|
||||||
start_murano
|
start_murano
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$1" == "unstack" ]]; then
|
if [[ "$1" == "unstack" ]]; then
|
||||||
stop_murano
|
stop_murano
|
||||||
if is_service_enabled horizon; then
|
|
||||||
cleanup_murano_dashboard
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -131,6 +131,46 @@ class MuranoClient(rest_client.RestClient):
|
|||||||
|
|
||||||
return resp, json.loads(body)
|
return resp, json.loads(body)
|
||||||
|
|
||||||
|
def get_list_packages(self):
|
||||||
|
resp, body = self.get('catalog/packages')
|
||||||
|
|
||||||
|
return resp, json.loads(body)
|
||||||
|
|
||||||
|
def get_package(self, id):
|
||||||
|
resp, body = self.get('catalog/packages/{0}'.format(id))
|
||||||
|
|
||||||
|
return resp, json.loads(body)
|
||||||
|
|
||||||
|
def update_package(self, id):
|
||||||
|
post_body = [
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/tags",
|
||||||
|
"value": ["i'm a test"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
resp, body = self.patch('catalog/packages/{0}'.format(id), post_body)
|
||||||
|
|
||||||
|
return resp, json.loads(body)
|
||||||
|
|
||||||
|
def delete_package(self, id):
|
||||||
|
return self.delete('catalog/packages/{0}'.format(id))
|
||||||
|
|
||||||
|
def download_package(self, id):
|
||||||
|
return self.get('catalog/packages/{0}/download'.format(id))
|
||||||
|
|
||||||
|
def get_ui_definition(self, id):
|
||||||
|
return self.get('catalog/packages/{0}/ui'.format(id))
|
||||||
|
|
||||||
|
def get_logo(self, id):
|
||||||
|
return self.get('catalog/packages/{0}/logo'.format(id))
|
||||||
|
|
||||||
|
def list_categories(self):
|
||||||
|
resp, body = self.get('catalog/packages/categories')
|
||||||
|
|
||||||
|
return resp, json.loads(body)
|
||||||
|
|
||||||
|
|
||||||
class TestCase(testtools.TestCase):
|
class TestCase(testtools.TestCase):
|
||||||
@classmethod
|
@classmethod
|
||||||
|
97
functionaltests/api/v1/test_repository.py
Normal file
97
functionaltests/api/v1/test_repository.py
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
# Copyright (c) 2014 Mirantis, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
from tempest.test import attr
|
||||||
|
|
||||||
|
from functionaltests.api import base
|
||||||
|
|
||||||
|
|
||||||
|
class TestRepository(base.TestCase):
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def setUpClass(cls):
|
||||||
|
|
||||||
|
super(TestRepository, cls).setUpClass()
|
||||||
|
|
||||||
|
raise cls.skipException("Murano Repository tests are disabled")
|
||||||
|
|
||||||
|
@attr(type='smoke')
|
||||||
|
def test_get_list_packages(self):
|
||||||
|
resp, body = self.client.get_list_packages()
|
||||||
|
|
||||||
|
self.assertEqual(200, resp.status)
|
||||||
|
self.assertTrue(isinstance(body['packages'], list))
|
||||||
|
|
||||||
|
@attr(type='smoke')
|
||||||
|
def test_get_package(self):
|
||||||
|
_, body = self.client.get_list_packages()
|
||||||
|
package = body['packages'][0]
|
||||||
|
|
||||||
|
resp, body = self.client.get_package(package['id'])
|
||||||
|
|
||||||
|
self.assertEqual(200, resp.status)
|
||||||
|
self.assertEqual(package, body)
|
||||||
|
|
||||||
|
@attr(type='smoke')
|
||||||
|
def test_update_package(self):
|
||||||
|
_, body = self.client.get_list_packages()
|
||||||
|
package = body['packages'][0]
|
||||||
|
|
||||||
|
resp, body = self.client.update_package(package['id'])
|
||||||
|
|
||||||
|
self.assertEqual(200, resp.status)
|
||||||
|
self.assertIn("i'm a test", body['tags'])
|
||||||
|
|
||||||
|
@attr(type='smoke')
|
||||||
|
def test_delete_package(self):
|
||||||
|
_, body = self.client.get_list_packages()
|
||||||
|
package = body['packages'][0]
|
||||||
|
|
||||||
|
resp, _ = self.client.delete_package(package['id'])
|
||||||
|
|
||||||
|
self.assertEqual(200, resp.status)
|
||||||
|
|
||||||
|
@attr(type='smoke')
|
||||||
|
def test_download_package(self):
|
||||||
|
_, body = self.client.get_list_packages()
|
||||||
|
package = body['packages'][0]
|
||||||
|
|
||||||
|
resp, _ = self.client.download_package(package['id'])
|
||||||
|
|
||||||
|
self.assertEqual(200, resp.status)
|
||||||
|
|
||||||
|
@attr(type='smoke')
|
||||||
|
def test_get_ui_definitions(self):
|
||||||
|
_, body = self.client.get_list_packages()
|
||||||
|
package = body['packages'][0]
|
||||||
|
|
||||||
|
resp, _ = self.client.get_ui_definition(package['id'])
|
||||||
|
|
||||||
|
self.assertEqual(200, resp.status)
|
||||||
|
|
||||||
|
@attr(type='smoke')
|
||||||
|
def test_get_logo(self):
|
||||||
|
_, body = self.client.get_list_packages()
|
||||||
|
package = body['packages'][0]
|
||||||
|
|
||||||
|
resp, _ = self.client.get_logo(package['id'])
|
||||||
|
|
||||||
|
self.assertEqual(200, resp.status)
|
||||||
|
|
||||||
|
@attr(type='smoke')
|
||||||
|
def test_get_list_categories(self):
|
||||||
|
resp, body = self.client.list_categories()
|
||||||
|
|
||||||
|
self.assertEqual(200, resp.status)
|
||||||
|
self.assertTrue(isinstance(body['categories'], list))
|
Loading…
Reference in New Issue
Block a user