Merge "Porting Meniscus Tenant API smoke tests and fixtures"
This commit is contained in:
31
.gitignore
vendored
Normal file
31
.gitignore
vendored
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
*.py[co]
|
||||||
|
|
||||||
|
# Packages
|
||||||
|
*.egg
|
||||||
|
*.egg-info
|
||||||
|
dist
|
||||||
|
build
|
||||||
|
eggs
|
||||||
|
parts
|
||||||
|
var
|
||||||
|
sdist
|
||||||
|
develop-eggs
|
||||||
|
.installed.cfg
|
||||||
|
|
||||||
|
# Installer logs
|
||||||
|
pip-log.txt
|
||||||
|
|
||||||
|
# Unit test / coverage reports
|
||||||
|
.coverage
|
||||||
|
.tox
|
||||||
|
|
||||||
|
#Translations
|
||||||
|
*.mo
|
||||||
|
|
||||||
|
#Mr Developer
|
||||||
|
.mr.developer.cfg
|
||||||
|
|
||||||
|
# IDE Project Files
|
||||||
|
*.project
|
||||||
|
*.pydev*
|
||||||
|
*.idea
|
||||||
15
test_repo/meniscus/__init__.py
Normal file
15
test_repo/meniscus/__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.
|
||||||
|
"""
|
||||||
148
test_repo/meniscus/fixtures.py
Normal file
148
test_repo/meniscus/fixtures.py
Normal file
@@ -0,0 +1,148 @@
|
|||||||
|
"""
|
||||||
|
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.fixtures import BaseTestFixture
|
||||||
|
from cloudcafe.meniscus.version_api.client import VersionClient
|
||||||
|
from cloudcafe.meniscus.tenant_api.client import \
|
||||||
|
TenantClient, ProducerClient, ProfileClient, HostClient
|
||||||
|
from cloudcafe.meniscus.config import \
|
||||||
|
MarshallingConfig, MeniscusConfig, TenantConfig
|
||||||
|
from cloudcafe.meniscus.tenant_api.behaviors \
|
||||||
|
import TenantBehaviors, ProducerBehaviors, ProfileBehaviors, HostBehaviors
|
||||||
|
|
||||||
|
|
||||||
|
class MeniscusFixture(BaseTestFixture):
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def setUpClass(cls):
|
||||||
|
super(MeniscusFixture, cls).setUpClass()
|
||||||
|
cls.marshalling = MarshallingConfig()
|
||||||
|
cls.meniscus_config = MeniscusConfig()
|
||||||
|
|
||||||
|
|
||||||
|
class VersionFixture(MeniscusFixture):
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def setUpClass(cls):
|
||||||
|
super(VersionFixture, cls).setUpClass()
|
||||||
|
cls.client = VersionClient(
|
||||||
|
url=cls.meniscus_config.base_url,
|
||||||
|
serialize_format=cls.marshalling.serializer,
|
||||||
|
deserialize_format=cls.marshalling.deserializer)
|
||||||
|
|
||||||
|
|
||||||
|
class TenantFixture(MeniscusFixture):
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def setUpClass(cls):
|
||||||
|
super(TenantFixture, cls).setUpClass()
|
||||||
|
cls.tenant_config = TenantConfig()
|
||||||
|
cls.tenant_client = TenantClient(
|
||||||
|
url=cls.meniscus_config.base_url,
|
||||||
|
api_version=cls.meniscus_config.api_version,
|
||||||
|
serialize_format=cls.marshalling.serializer,
|
||||||
|
deserialize_format=cls.marshalling.deserializer)
|
||||||
|
cls.tenant_behaviors = TenantBehaviors(cls.tenant_client,
|
||||||
|
cls.tenant_config)
|
||||||
|
|
||||||
|
|
||||||
|
class ProducerFixture(TenantFixture):
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def setUpClass(cls):
|
||||||
|
super(ProducerFixture, cls).setUpClass()
|
||||||
|
|
||||||
|
cls.tenant_id, resp = cls.tenant_behaviors.create_tenant()
|
||||||
|
cls.producer_client = ProducerClient(
|
||||||
|
url=cls.meniscus_config.base_url,
|
||||||
|
api_version=cls.meniscus_config.api_version,
|
||||||
|
tenant_id=cls.tenant_id,
|
||||||
|
serialize_format=cls.marshalling.serializer,
|
||||||
|
deserialize_format=cls.marshalling.deserializer)
|
||||||
|
cls.producer_behaviors = ProducerBehaviors(
|
||||||
|
tenant_client=cls.tenant_client,
|
||||||
|
producer_client=cls.producer_client,
|
||||||
|
tenant_config=cls.tenant_config)
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
for producer_id in self.producer_behaviors.producers_created:
|
||||||
|
self.producer_behaviors.delete_producer(producer_id, False)
|
||||||
|
|
||||||
|
|
||||||
|
class ProfileFixture(ProducerFixture):
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def setUpClass(cls):
|
||||||
|
super(ProfileFixture, cls).setUpClass()
|
||||||
|
|
||||||
|
cls.profile_client = ProfileClient(
|
||||||
|
url=cls.meniscus_config.base_url,
|
||||||
|
api_version=cls.meniscus_config.api_version,
|
||||||
|
tenant_id=cls.tenant_id,
|
||||||
|
producer_id=None,
|
||||||
|
serialize_format=cls.marshalling.serializer,
|
||||||
|
deserialize_format=cls.marshalling.deserializer)
|
||||||
|
cls.profile_behaviors = ProfileBehaviors(
|
||||||
|
tenant_client=cls.tenant_client,
|
||||||
|
producer_client=cls.producer_client,
|
||||||
|
profile_client=cls.profile_client,
|
||||||
|
tenant_config=cls.tenant_config)
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
super(ProfileFixture, self).setUp()
|
||||||
|
resp = self.producer_behaviors.create_producer()
|
||||||
|
self.producer_id = resp['producer_id']
|
||||||
|
self.profile_client.producer_id = self.producer_id
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
for profile_id in self.profile_behaviors.profiles_created:
|
||||||
|
self.profile_behaviors.delete_profile(profile_id, False)
|
||||||
|
|
||||||
|
super(ProfileFixture, self).tearDown()
|
||||||
|
|
||||||
|
|
||||||
|
class HostFixture(ProfileFixture):
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def setUpClass(cls):
|
||||||
|
super(HostFixture, cls).setUpClass()
|
||||||
|
|
||||||
|
cls.host_client = HostClient(
|
||||||
|
url=cls.meniscus_config.base_url,
|
||||||
|
api_version=cls.meniscus_config.api_version,
|
||||||
|
tenant_id=cls.tenant_id,
|
||||||
|
profile_id=None,
|
||||||
|
serialize_format=cls.marshalling.serializer,
|
||||||
|
deserialize_format=cls.marshalling.deserializer)
|
||||||
|
cls.host_behaviors = HostBehaviors(
|
||||||
|
tenant_client=cls.tenant_client,
|
||||||
|
producer_client=cls.producer_client,
|
||||||
|
profile_client=cls.profile_client,
|
||||||
|
host_client=cls.host_client,
|
||||||
|
tenant_config=cls.tenant_config)
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
super(HostFixture, self).setUp()
|
||||||
|
|
||||||
|
resp = self.profile_behaviors.create_new_profile(
|
||||||
|
producer_ids=[self.producer_id])
|
||||||
|
self.profile_id = resp['profile_id']
|
||||||
|
self.host_client.profile_id = self.profile_id
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
for host_id in self.host_behaviors.hosts_created:
|
||||||
|
self.host_behaviors.delete_host(host_id, False)
|
||||||
|
|
||||||
|
super(HostFixture, self).tearDown()
|
||||||
15
test_repo/meniscus/smoke/__init__.py
Normal file
15
test_repo/meniscus/smoke/__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.
|
||||||
|
"""
|
||||||
84
test_repo/meniscus/smoke/host.py
Normal file
84
test_repo/meniscus/smoke/host.py
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
"""
|
||||||
|
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.meniscus.fixtures import HostFixture
|
||||||
|
|
||||||
|
|
||||||
|
class TestHost(HostFixture):
|
||||||
|
|
||||||
|
def test_create_host(self):
|
||||||
|
result = self.host_behaviors.create_new_host(
|
||||||
|
ip_v4=self.tenant_config.ip_address_v4,
|
||||||
|
ip_v6=self.tenant_config.ip_address_v6,
|
||||||
|
profile_id=self.profile_id)
|
||||||
|
self.assertEqual(result['request'].status_code, 201)
|
||||||
|
|
||||||
|
def test_delete_host(self):
|
||||||
|
result = self.host_behaviors.create_new_host()
|
||||||
|
response = self.host_behaviors.delete_host(result['host_id'])
|
||||||
|
|
||||||
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
|
def test_update_host(self):
|
||||||
|
host_result = self.host_behaviors.create_new_host()
|
||||||
|
|
||||||
|
# We currently have to set all values on the update due to an issue
|
||||||
|
# when profile_id is equal to None.
|
||||||
|
host_id = host_result['host_id']
|
||||||
|
self.host_client.update_host(host_id=host_id,
|
||||||
|
hostname='new_hostname',
|
||||||
|
ip_v4='10.10.1.2',
|
||||||
|
ip_v6='::1',
|
||||||
|
profile_id=self.profile_id)
|
||||||
|
|
||||||
|
host_response = self.host_client.get_host(host_id)
|
||||||
|
host = host_response.entity
|
||||||
|
|
||||||
|
self.assertEqual(host_response.status_code, 200,
|
||||||
|
'Status code should have been 200 OK')
|
||||||
|
self.assertEqual(host.hostname, 'new_hostname', 'Incorrect hostname')
|
||||||
|
self.assertEqual(host.ip_address_v4, '10.10.1.2')
|
||||||
|
self.assertEqual(host.ip_address_v6, '::1')
|
||||||
|
|
||||||
|
def test_get_host(self):
|
||||||
|
host_result = self.host_behaviors.create_new_host()
|
||||||
|
host_id = host_result['host_id']
|
||||||
|
|
||||||
|
host_response = self.host_client.get_host(host_id)
|
||||||
|
host = host_response.entity
|
||||||
|
|
||||||
|
self.assertEqual(200, host_response.status_code,
|
||||||
|
'Status code should have been 200 OK')
|
||||||
|
self.assertIsNotNone(host)
|
||||||
|
self.assertEqual('testhost', host.hostname, 'Incorrect hostname')
|
||||||
|
self.assertEqual(host_id, host.id, 'Unexpected host id')
|
||||||
|
|
||||||
|
def test_get_all_hosts(self):
|
||||||
|
first_hostname = self.tenant_config.hostname
|
||||||
|
second_hostname = 'testhost_2'
|
||||||
|
|
||||||
|
host1_result = self.host_behaviors.create_new_host(first_hostname)
|
||||||
|
host2_result = self.host_behaviors.create_new_host(second_hostname)
|
||||||
|
|
||||||
|
host1 = self.host_client.get_host(host1_result['host_id']).entity
|
||||||
|
host2 = self.host_client.get_host(host2_result['host_id']).entity
|
||||||
|
|
||||||
|
hosts_resp = self.host_client.get_all_hosts()
|
||||||
|
hosts = hosts_resp.entity
|
||||||
|
|
||||||
|
self.assertEqual(200, hosts_resp.status_code)
|
||||||
|
self.assertEqual(len(hosts), 2)
|
||||||
|
self.assertIn(host1, hosts)
|
||||||
|
self.assertIn(host2, hosts)
|
||||||
71
test_repo/meniscus/smoke/producer.py
Normal file
71
test_repo/meniscus/smoke/producer.py
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
"""
|
||||||
|
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.meniscus.fixtures import ProducerFixture
|
||||||
|
from cloudcafe.compute.common.datagen import random_string
|
||||||
|
|
||||||
|
|
||||||
|
class TestProducer(ProducerFixture):
|
||||||
|
|
||||||
|
def test_create_producer(self):
|
||||||
|
result = self.producer_behaviors.create_producer()
|
||||||
|
self.assertEqual(result['request'].status_code, 201)
|
||||||
|
|
||||||
|
def test_delete_producer(self):
|
||||||
|
result = self.producer_behaviors.create_producer()
|
||||||
|
self.assertEqual(result['request'].status_code, 201)
|
||||||
|
|
||||||
|
resp = self.producer_behaviors.delete_producer(result['producer_id'])
|
||||||
|
self.assertEqual(resp.status_code, 200, 'Wrong status code on delete')
|
||||||
|
|
||||||
|
def test_get_producer(self):
|
||||||
|
result = self.producer_behaviors.create_producer()
|
||||||
|
original_id = result['producer_id']
|
||||||
|
|
||||||
|
resp = self.producer_client.get_producer(original_id)
|
||||||
|
producer = resp.entity
|
||||||
|
|
||||||
|
self.assertEqual(resp.status_code, 200)
|
||||||
|
self.assertEqual(producer.id, original_id)
|
||||||
|
|
||||||
|
def test_get_all_producers(self):
|
||||||
|
result = self.producer_behaviors.create_producer()
|
||||||
|
id_1 = result['producer_id']
|
||||||
|
result = self.producer_behaviors.create_producer(name=random_string())
|
||||||
|
id_2 = result['producer_id']
|
||||||
|
|
||||||
|
resp = self.producer_client.get_all_producers()
|
||||||
|
producers = resp.entity
|
||||||
|
|
||||||
|
self.assertEqual(resp.status_code, 200)
|
||||||
|
self.assertEqual(len(producers), 2)
|
||||||
|
self.assertIn(True, [producer.id == id_1 for producer in producers])
|
||||||
|
self.assertIn(True, [producer.id == id_2 for producer in producers])
|
||||||
|
|
||||||
|
def test_update_producer(self):
|
||||||
|
result = self.producer_behaviors.create_producer()
|
||||||
|
producer_id = result['producer_id']
|
||||||
|
|
||||||
|
update_name = random_string()
|
||||||
|
resp = self.producer_client.update_producer(
|
||||||
|
producer_id=producer_id,
|
||||||
|
name=update_name)
|
||||||
|
|
||||||
|
self.assertEqual(resp.status_code, 200)
|
||||||
|
|
||||||
|
resp = self.producer_client.get_producer(producer_id)
|
||||||
|
producer = resp.entity
|
||||||
|
|
||||||
|
self.assertEqual(producer.name, update_name)
|
||||||
95
test_repo/meniscus/smoke/profile.py
Normal file
95
test_repo/meniscus/smoke/profile.py
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
"""
|
||||||
|
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.meniscus.fixtures import ProfileFixture
|
||||||
|
|
||||||
|
|
||||||
|
class TestProfiles(ProfileFixture):
|
||||||
|
|
||||||
|
def test_create_profile(self):
|
||||||
|
result = self.profile_behaviors.create_new_profile()
|
||||||
|
self.assertEqual(result['request'].status_code, 201)
|
||||||
|
|
||||||
|
def test_delete_profile(self):
|
||||||
|
result = self.profile_behaviors.create_new_profile()
|
||||||
|
created_id = result['profile_id']
|
||||||
|
|
||||||
|
resp = self.profile_behaviors.delete_profile(created_id)
|
||||||
|
self.assertEqual(resp.status_code, 200)
|
||||||
|
|
||||||
|
def test_get_profile(self):
|
||||||
|
profile_results = self.profile_behaviors.create_new_profile()
|
||||||
|
profile_id = profile_results['profile_id']
|
||||||
|
profile_resp = self.profile_client.get_profile(profile_id)
|
||||||
|
profile = profile_resp.entity
|
||||||
|
|
||||||
|
self.assertEqual(profile_resp.status_code, 200,
|
||||||
|
'Status code should have been 200 OK')
|
||||||
|
self.assertIsNotNone(profile)
|
||||||
|
self.assertEqual(profile.name, self.tenant_config.profile_name)
|
||||||
|
|
||||||
|
def test_get_all_profiles(self):
|
||||||
|
req_one = self.profile_behaviors.create_new_profile()
|
||||||
|
req_two = self.profile_behaviors.create_new_profile(name='pro2')
|
||||||
|
|
||||||
|
profile_id_one = req_one['profile_id']
|
||||||
|
profile_id_two = req_two['profile_id']
|
||||||
|
|
||||||
|
profile_res_one = self.profile_client.get_profile(profile_id_one)
|
||||||
|
profile_res_two = self.profile_client.get_profile(profile_id_two)
|
||||||
|
|
||||||
|
profile_list_req = self.profile_client.get_all_profiles()
|
||||||
|
profile_list = profile_list_req.entity
|
||||||
|
|
||||||
|
profile_one_name = profile_res_one.entity.name
|
||||||
|
profile_two_name = profile_res_two.entity.name
|
||||||
|
|
||||||
|
self.assertEqual(2, len(profile_list))
|
||||||
|
self.assertEqual(profile_one_name, self.tenant_config.profile_name)
|
||||||
|
self.assertEqual(profile_two_name, 'pro2')
|
||||||
|
|
||||||
|
def test_update_profile(self):
|
||||||
|
initial_profile_results = self.profile_behaviors.create_new_profile()
|
||||||
|
created_id = initial_profile_results['profile_id']
|
||||||
|
|
||||||
|
# Update
|
||||||
|
update_profile_results = self.profile_client.update_profile(
|
||||||
|
id=created_id,
|
||||||
|
name='updated_profile')
|
||||||
|
|
||||||
|
self.assertEqual(update_profile_results.status_code, 200,
|
||||||
|
'Should have been 200 OK')
|
||||||
|
|
||||||
|
updated_results = self.profile_client.get_profile(created_id)
|
||||||
|
updated_name = updated_results.entity.name
|
||||||
|
|
||||||
|
self.assertEqual(updated_name, 'updated_profile')
|
||||||
|
|
||||||
|
def test_unlink_producer_update_profile(self):
|
||||||
|
initial_profile_results = self.profile_behaviors.create_new_profile()
|
||||||
|
created_id = initial_profile_results['profile_id']
|
||||||
|
update_profile_results = self.profile_client.update_profile(
|
||||||
|
id=created_id,
|
||||||
|
name='updated_profile',
|
||||||
|
producer_ids=[])
|
||||||
|
self.assertEqual(update_profile_results.status_code, 200,
|
||||||
|
'Should have been 200 OK')
|
||||||
|
|
||||||
|
updated_results = self.profile_client.get_profile(created_id)
|
||||||
|
profile = updated_results.entity
|
||||||
|
|
||||||
|
self.assertEqual(profile.name, 'updated_profile')
|
||||||
|
self.assertEqual(len(profile.event_producers), 0,
|
||||||
|
'event producer size is 0')
|
||||||
33
test_repo/meniscus/smoke/tenant.py
Normal file
33
test_repo/meniscus/smoke/tenant.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.meniscus.fixtures import TenantFixture
|
||||||
|
|
||||||
|
|
||||||
|
class TestTenant(TenantFixture):
|
||||||
|
|
||||||
|
def test_create_tenant(self):
|
||||||
|
tenant_id, resp = self.tenant_behaviors.create_tenant()
|
||||||
|
self.assertEqual(resp.status_code, 201,
|
||||||
|
'Wrong status code. The tenant was probably not '
|
||||||
|
'created')
|
||||||
|
|
||||||
|
def test_get_tenant(self):
|
||||||
|
tenant_id, resp = self.tenant_behaviors.create_tenant()
|
||||||
|
resp = self.tenant_client.get_tenant(tenant_id)
|
||||||
|
|
||||||
|
self.assertEqual(resp.status_code, 200)
|
||||||
|
self.assertIsNotNone(resp.entity)
|
||||||
|
self.assertEqual(resp.entity[0].tenant_id, tenant_id)
|
||||||
28
test_repo/meniscus/smoke/version.py
Normal file
28
test_repo/meniscus/smoke/version.py
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
"""
|
||||||
|
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.meniscus.fixtures import VersionFixture
|
||||||
|
|
||||||
|
|
||||||
|
class TestVersion(VersionFixture):
|
||||||
|
|
||||||
|
def test_get_version(self):
|
||||||
|
response = self.client.get_version()
|
||||||
|
version_list = response.entity
|
||||||
|
|
||||||
|
self.assertEqual(response.status_code, 200)
|
||||||
|
self.assertGreater(len(version_list), 0, "version list is empty")
|
||||||
|
self.assertEqual(version_list[0].v1, 'current')
|
||||||
Reference in New Issue
Block a user