Add of flavor admin and keypair tests
* Modifications to compute fixture to accomidate admin config * Added basic keypair test * Added basic add/delete flavor test Change-Id: I6a1feb1298f876568d1779c47a79644581f07d66
This commit is contained in:
33
test_repo/compute/admin/test_flavors_admin.py
Normal file
33
test_repo/compute/admin/test_flavors_admin.py
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
"""
|
||||||
|
Copyright 2013 Rackspace
|
||||||
|
|
||||||
|
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 cafe.drivers.unittest.decorators import tags
|
||||||
|
from test_repo.compute.fixtures import ComputeAdminFixture
|
||||||
|
|
||||||
|
class FlavorsAdminTest(ComputeAdminFixture):
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def setUpClass(cls):
|
||||||
|
super(FlavorsAdminTest, cls).setUpClass()
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def tearDownClass(cls):
|
||||||
|
super(FlavorsAdminTest, cls).tearDownClass()
|
||||||
|
|
||||||
|
def test_create_delete_flavors(self):
|
||||||
|
self.admin_flavors_client.create_flavor(name='test2', ram='128', vcpus='1',
|
||||||
|
disk='10', id='99', is_public=True)
|
||||||
|
self.admin_flavors_client.delete_flavor('99')
|
||||||
15
test_repo/compute/extensions/__init__.py
Normal file
15
test_repo/compute/extensions/__init__.py
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
"""
|
||||||
|
Copyright 2013 Rackspace
|
||||||
|
|
||||||
|
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.
|
||||||
|
"""
|
||||||
15
test_repo/compute/extensions/keypairs/__init__.py
Normal file
15
test_repo/compute/extensions/keypairs/__init__.py
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
"""
|
||||||
|
Copyright 2013 Rackspace
|
||||||
|
|
||||||
|
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.
|
||||||
|
"""
|
||||||
33
test_repo/compute/extensions/keypairs/test_keypairs.py
Normal file
33
test_repo/compute/extensions/keypairs/test_keypairs.py
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
"""
|
||||||
|
Copyright 2013 Rackspace
|
||||||
|
|
||||||
|
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 test_repo.compute.fixtures import ComputeFixture
|
||||||
|
|
||||||
|
class FlavorsTest(ComputeFixture):
|
||||||
|
|
||||||
|
def test_create_delete_keypair(self):
|
||||||
|
resp = self.keypairs_client.create_keypair('test3')
|
||||||
|
self.assertEqual(resp.status_code, 200)
|
||||||
|
|
||||||
|
keypair = resp.entity
|
||||||
|
self.assertEqual(keypair.name, 'test3')
|
||||||
|
self.assertIsNotNone(keypair.public_key)
|
||||||
|
self.assertIsNotNone(keypair.fingerprint)
|
||||||
|
|
||||||
|
self.keypairs_client.list_keypairs()
|
||||||
|
|
||||||
|
self.keypairs_client.delete_keypair('test3')
|
||||||
|
|
||||||
@@ -24,6 +24,7 @@ from cloudcafe.compute.common.exception_handler import ExceptionHandler
|
|||||||
from cloudcafe.compute.flavors_api.client import FlavorsClient
|
from cloudcafe.compute.flavors_api.client import FlavorsClient
|
||||||
from cloudcafe.compute.servers_api.client import ServersClient
|
from cloudcafe.compute.servers_api.client import ServersClient
|
||||||
from cloudcafe.compute.images_api.client import ImagesClient
|
from cloudcafe.compute.images_api.client import ImagesClient
|
||||||
|
from cloudcafe.compute.extensions.keypairs_api.client import KeypairsClient
|
||||||
from cloudcafe.compute.servers_api.behaviors import ServerBehaviors
|
from cloudcafe.compute.servers_api.behaviors import ServerBehaviors
|
||||||
from cloudcafe.compute.images_api.behaviors import ImageBehaviors
|
from cloudcafe.compute.images_api.behaviors import ImageBehaviors
|
||||||
from cloudcafe.compute.config import ComputeConfig
|
from cloudcafe.compute.config import ComputeConfig
|
||||||
@@ -33,11 +34,9 @@ from cloudcafe.compute.servers_api.config import ServersConfig
|
|||||||
from cloudcafe.extensions.rax_auth.v2_0.tokens_api.client import TokenAPI_Client
|
from cloudcafe.extensions.rax_auth.v2_0.tokens_api.client import TokenAPI_Client
|
||||||
from cloudcafe.extensions.rax_auth.v2_0.tokens_api.behaviors import TokenAPI_Behaviors
|
from cloudcafe.extensions.rax_auth.v2_0.tokens_api.behaviors import TokenAPI_Behaviors
|
||||||
from cloudcafe.extensions.rax_auth.v2_0.tokens_api.config import TokenAPI_Config
|
from cloudcafe.extensions.rax_auth.v2_0.tokens_api.config import TokenAPI_Config
|
||||||
|
|
||||||
from cloudcafe.identity.v2_0.tokens_api.client import TokenAPI_Client as OSTokenAPI_Client
|
from cloudcafe.identity.v2_0.tokens_api.client import TokenAPI_Client as OSTokenAPI_Client
|
||||||
from cloudcafe.identity.v2_0.tokens_api.behaviors import TokenAPI_Behaviors as OSTokenAPI_Behaviors
|
from cloudcafe.identity.v2_0.tokens_api.behaviors import TokenAPI_Behaviors as OSTokenAPI_Behaviors
|
||||||
from cloudcafe.identity.v2_0.tokens_api.config import TokenAPI_Config as OSTokenAPI_Config
|
from cloudcafe.identity.v2_0.tokens_api.config import TokenAPI_Config as OSTokenAPI_Config
|
||||||
|
|
||||||
from cloudcafe.compute.config import ComputeAdminConfig
|
from cloudcafe.compute.config import ComputeAdminConfig
|
||||||
|
|
||||||
|
|
||||||
@@ -78,6 +77,8 @@ class ComputeFixture(BaseTestFixture):
|
|||||||
'json', 'json')
|
'json', 'json')
|
||||||
cls.images_client = ImagesClient(url, access_data.token.id_,
|
cls.images_client = ImagesClient(url, access_data.token.id_,
|
||||||
'json', 'json')
|
'json', 'json')
|
||||||
|
#cls.keypairs_client = KeypairsClient(url, access_data.token.id_,
|
||||||
|
# 'json', 'json')
|
||||||
cls.server_behaviors = ServerBehaviors(cls.servers_client,
|
cls.server_behaviors = ServerBehaviors(cls.servers_client,
|
||||||
cls.servers_config,
|
cls.servers_config,
|
||||||
cls.images_config,
|
cls.images_config,
|
||||||
@@ -207,25 +208,19 @@ class ComputeAdminFixture(BaseTestFixture):
|
|||||||
compute_service = access_data.get_service(
|
compute_service = access_data.get_service(
|
||||||
cls.compute_config.compute_endpoint_name)
|
cls.compute_config.compute_endpoint_name)
|
||||||
url = compute_service.get_endpoint(
|
url = compute_service.get_endpoint(
|
||||||
cls.compute_config.region).public_url
|
compute_admin_config.region).public_url
|
||||||
cls.flavors_client = FlavorsClient(url, access_data.token.id_,
|
cls.admin_flavors_client = FlavorsClient(url, access_data.token.id_,
|
||||||
'json', 'json')
|
'json', 'json')
|
||||||
cls.servers_client = ServersClient(url, access_data.token.id_,
|
cls.admin_servers_client = ServersClient(url, access_data.token.id_,
|
||||||
'json', 'json')
|
'json', 'json')
|
||||||
cls.images_client = ImagesClient(url, access_data.token.id_,
|
cls.admin_server_behaviors = ServerBehaviors(cls.admin_servers_client,
|
||||||
'json', 'json')
|
cls.servers_config,
|
||||||
cls.server_behaviors = ServerBehaviors(cls.servers_client,
|
cls.images_config,
|
||||||
cls.servers_config,
|
cls.flavors_config)
|
||||||
cls.images_config,
|
cls.admin_servers_client.add_exception_handler(ExceptionHandler())
|
||||||
cls.flavors_config)
|
|
||||||
cls.image_behaviors = ImageBehaviors(cls.images_client,
|
|
||||||
cls.images_config)
|
|
||||||
cls.flavors_client.add_exception_handler(ExceptionHandler())
|
|
||||||
cls.resources = ResourcePool()
|
|
||||||
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
super(ComputeAdminFixture, cls).tearDownClass()
|
super(ComputeAdminFixture, cls).tearDownClass()
|
||||||
cls.flavors_client.delete_exception_handler(ExceptionHandler())
|
cls.flavors_client.delete_exception_handler(ExceptionHandler())
|
||||||
#cls.resources.release()
|
cls.resources.release()
|
||||||
|
|||||||
Reference in New Issue
Block a user