Merge "Makes run_tests.sh exit code match the nosetests exit value."
diff --git a/tempest/api/identity/admin/v3/test_domains.py b/tempest/api/identity/admin/v3/test_domains.py
new file mode 100644
index 0000000..8d019fe
--- /dev/null
+++ b/tempest/api/identity/admin/v3/test_domains.py
@@ -0,0 +1,54 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2013 OpenStack Foundation
+# All Rights Reserved.
+#
+# 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.api.identity import base
+from tempest.common.utils.data_utils import rand_name
+from tempest.test import attr
+
+
+class DomainsTestJSON(base.BaseIdentityAdminTest):
+ _interface = 'json'
+
+ def _delete_domain(self, domain_id):
+ # It is necessary to disable the domian before deleting,
+ # or else it would result in unauthorized error
+ _, body = self.v3_client.update_domain(domain_id, enabled=False)
+ resp, _ = self.v3_client.delete_domain(domain_id)
+ self.assertEqual(204, resp.status)
+
+ @attr(type='smoke')
+ def test_list_domains(self):
+ #Test to list domains
+ domain_ids = list()
+ fetched_ids = list()
+ for _ in range(3):
+ _, domain = self.v3_client.create_domain(
+ rand_name('domain-'), description=rand_name('domain-desc-'))
+ # Delete the domian at the end of this method
+ self.addCleanup(self._delete_domain, domain['id'])
+ domain_ids.append(domain['id'])
+ # List and Verify Domains
+ resp, body = self.v3_client.list_domains()
+ self.assertEqual(resp['status'], '200')
+ for d in body:
+ fetched_ids.append(d['id'])
+ missing_doms = [d for d in domain_ids if d not in fetched_ids]
+ self.assertEqual(0, len(missing_doms))
+
+
+class DomainsTestXML(DomainsTestJSON):
+ _interface = 'xml'
diff --git a/tempest/api/object_storage/test_account_services.py b/tempest/api/object_storage/test_account_services.py
index d7b87d1..b40774e 100644
--- a/tempest/api/object_storage/test_account_services.py
+++ b/tempest/api/object_storage/test_account_services.py
@@ -53,27 +53,25 @@
self.assertIn('x-account-bytes-used', resp)
@attr(type='smoke')
- def test_create_account_metadata(self):
+ def test_create_and_delete_account_metadata(self):
+ header = 'test-account-meta'
+ data = 'Meta!'
# add metadata to account
- metadata = {'test-account-meta': 'Meta!'}
- resp, _ = \
- self.account_client.create_account_metadata(metadata=metadata)
+ resp, _ = self.account_client.create_account_metadata(
+ metadata={header: data})
self.assertEqual(resp['status'], '204')
- resp, metadata = self.account_client.list_account_metadata()
- self.assertIn('x-account-meta-test-account-meta', resp)
- self.assertEqual(resp['x-account-meta-test-account-meta'], 'Meta!')
+ resp, _ = self.account_client.list_account_metadata()
+ self.assertIn('x-account-meta-' + header, resp)
+ self.assertEqual(resp['x-account-meta-' + header], data)
- @attr(type='smoke')
- def test_delete_account_metadata(self):
# delete metadata from account
- metadata = ['test-account-meta']
resp, _ = \
- self.account_client.delete_account_metadata(metadata=metadata)
+ self.account_client.delete_account_metadata(metadata=[header])
self.assertEqual(resp['status'], '204')
- resp, metadata = self.account_client.list_account_metadata()
- self.assertNotIn('x-account-meta-test-account-meta', resp)
+ resp, _ = self.account_client.list_account_metadata()
+ self.assertNotIn('x-account-meta-' + header, resp)
@attr(type=['negative', 'gate'])
def test_list_containers_with_non_authorized_user(self):
diff --git a/tempest/api/object_storage/test_object_services.py b/tempest/api/object_storage/test_object_services.py
index f7d2f88..2b8feef 100644
--- a/tempest/api/object_storage/test_object_services.py
+++ b/tempest/api/object_storage/test_object_services.py
@@ -298,7 +298,6 @@
self.container_name, object_name,
metadata=self.custom_headers)
- @testtools.skip('Until Bug #1097137 is resolved.')
@attr(type='gate')
def test_get_object_using_temp_url(self):
# access object using temporary URL within expiration time
diff --git a/tempest/services/identity/v3/json/identity_client.py b/tempest/services/identity/v3/json/identity_client.py
index 014df1e..adbdc83 100644
--- a/tempest/services/identity/v3/json/identity_client.py
+++ b/tempest/services/identity/v3/json/identity_client.py
@@ -160,3 +160,51 @@
(project_id, user_id, role_id), None,
self.headers)
return resp, body
+
+ def create_domain(self, name, **kwargs):
+ """Creates a domain."""
+ description = kwargs.get('description', None)
+ en = kwargs.get('enabled', True)
+ post_body = {
+ 'description': description,
+ 'enabled': en,
+ 'name': name
+ }
+ post_body = json.dumps({'domain': post_body})
+ resp, body = self.post('domains', post_body, self.headers)
+ body = json.loads(body)
+ return resp, body['domain']
+
+ def delete_domain(self, domain_id):
+ """Delete a domain."""
+ resp, body = self.delete('domains/%s' % str(domain_id))
+ return resp, body
+
+ def list_domains(self):
+ """List Domains."""
+ resp, body = self.get('domains')
+ body = json.loads(body)
+ return resp, body['domains']
+
+ def update_domain(self, domain_id, **kwargs):
+ """Updates a domain."""
+ resp, body = self.get_domain(domain_id)
+ description = kwargs.get('description', body['description'])
+ en = kwargs.get('enabled', body['enabled'])
+ name = kwargs.get('name', body['name'])
+ post_body = {
+ 'description': description,
+ 'enabled': en,
+ 'name': name
+ }
+ post_body = json.dumps({'domain': post_body})
+ resp, body = self.patch('domains/%s' % domain_id, post_body,
+ self.headers)
+ body = json.loads(body)
+ return resp, body['domain']
+
+ def get_domain(self, domain_id):
+ """Get Domain details."""
+ resp, body = self.get('domains/%s' % domain_id)
+ body = json.loads(body)
+ return resp, body['domain']
diff --git a/tempest/services/identity/v3/xml/identity_client.py b/tempest/services/identity/v3/xml/identity_client.py
index 92151dd..708ee28 100644
--- a/tempest/services/identity/v3/xml/identity_client.py
+++ b/tempest/services/identity/v3/xml/identity_client.py
@@ -44,6 +44,14 @@
array.append(xml_to_json(child))
return array
+ def _parse_domains(self, node):
+ array = []
+ for child in node.getchildren():
+ tag_list = child.tag.split('}', 1)
+ if tag_list[1] == "domain":
+ array.append(xml_to_json(child))
+ return array
+
def _parse_array(self, node):
array = []
for child in node.getchildren():
@@ -185,3 +193,51 @@
resp, body = self.put('projects/%s/users/%s/roles/%s' %
(project_id, user_id, role_id), '', self.headers)
return resp, body
+
+ def create_domain(self, name, **kwargs):
+ """Creates a domain."""
+ description = kwargs.get('description', None)
+ en = kwargs.get('enabled', True)
+ post_body = Element("domain",
+ xmlns=XMLNS,
+ name=name,
+ description=description,
+ enabled=str(en).lower())
+ resp, body = self.post('domains', str(Document(post_body)),
+ self.headers)
+ body = self._parse_body(etree.fromstring(body))
+ return resp, body
+
+ def list_domains(self):
+ """Get the list of domains."""
+ resp, body = self.get("domains", self.headers)
+ body = self._parse_domains(etree.fromstring(body))
+ return resp, body
+
+ def delete_domain(self, domain_id):
+ """Delete a domain."""
+ resp, body = self.delete('domains/%s' % domain_id, self.headers)
+ return resp, body
+
+ def update_domain(self, domain_id, **kwargs):
+ """Updates a domain."""
+ resp, body = self.get_domain(domain_id)
+ description = kwargs.get('description', body['description'])
+ en = kwargs.get('enabled', body['enabled'])
+ name = kwargs.get('name', body['name'])
+ post_body = Element("domain",
+ xmlns=XMLNS,
+ name=name,
+ description=description,
+ enabled=str(en).lower())
+ resp, body = self.patch('domains/%s' % domain_id,
+ str(Document(post_body)),
+ self.headers)
+ body = self._parse_body(etree.fromstring(body))
+ return resp, body
+
+ def get_domain(self, domain_id):
+ """Get Domain details."""
+ resp, body = self.get('domains/%s' % domain_id, self.headers)
+ body = self._parse_body(etree.fromstring(body))
+ return resp, body
diff --git a/tools/skip_tracker.py b/tools/skip_tracker.py
index a4cf394..c7b0033 100755
--- a/tools/skip_tracker.py
+++ b/tools/skip_tracker.py
@@ -28,7 +28,7 @@
from launchpadlib import launchpad
BASEDIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
-TESTDIR = os.path.join(BASEDIR, 'tempest', 'tests')
+TESTDIR = os.path.join(BASEDIR, 'tempest')
LPCACHEDIR = os.path.expanduser('~/.launchpadlib/cache')