summaryrefslogtreecommitdiffstats
path: root/tests/test_versions.py
diff options
context:
space:
mode:
authorAnthony Young <sleepsonthefloor@gmail.com>2012-02-09 17:08:47 +0000
committerAnthony Young <sleepsonthefloor@gmail.com>2012-02-10 10:35:30 -0800
commit9028f3228b785cfefbbe3cd6532485817262c51d (patch)
treed3433fce00a09291c7701dd3f3bcf6ba0861d354 /tests/test_versions.py
parent1951c87de39f8dde704632512db92b22f967bf08 (diff)
downloadkeystone-9028f3228b785cfefbbe3cd6532485817262c51d.tar.gz
keystone-9028f3228b785cfefbbe3cd6532485817262c51d.tar.xz
keystone-9028f3228b785cfefbbe3cd6532485817262c51d.zip
Add version description to root path
* Fixes 925548 * Fix test for correct assertion * / returns {} Change-Id: I1067b402ad1bab474781e29ab7761f644f076540
Diffstat (limited to 'tests/test_versions.py')
-rw-r--r--tests/test_versions.py107
1 files changed, 107 insertions, 0 deletions
diff --git a/tests/test_versions.py b/tests/test_versions.py
new file mode 100644
index 00000000..6a088654
--- /dev/null
+++ b/tests/test_versions.py
@@ -0,0 +1,107 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2012 OpenStack, LLC
+# 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.
+
+import json
+
+from keystone import test
+from keystone import config
+
+
+CONF = config.CONF
+
+
+class VersionTestCase(test.TestCase):
+ def setUp(self):
+ super(VersionTestCase, self).setUp()
+ self.load_backends()
+ self.public_app = self.loadapp('keystone', 'main')
+ self.admin_app = self.loadapp('keystone', 'admin')
+
+ self.public_server = self.serveapp('keystone', name='main')
+ self.admin_server = self.serveapp('keystone', name='admin')
+
+ def test_public_versions(self):
+ client = self.client(self.public_app)
+ resp = client.get('/')
+ data = json.loads(resp.body)
+ expected = {
+ "versions": {
+ "values": [{
+ "id": "v2.0",
+ "status": "beta",
+ "updated": "2011-11-19T00:00:00Z",
+ "links": [{
+ "rel": "self",
+ "href": ("http://localhost:%s/v2.0/" %
+ CONF.public_port),
+ }, {
+ "rel": "describedby",
+ "type": "text/html",
+ "href": "http://docs.openstack.org/api/openstack-"
+ "identity-service/2.0/content/"
+ }, {
+ "rel": "describedby",
+ "type": "application/pdf",
+ "href": "http://docs.openstack.org/api/openstack-"
+ "identity-service/2.0/identity-dev-guide-"
+ "2.0.pdf"
+ }],
+ "media-types": [{
+ "base": "application/json",
+ "type": "application/vnd.openstack.identity-v2.0"
+ "+json"
+ }]
+ }]
+ }
+ }
+ self.assertEqual(data, expected)
+
+ def test_admin_versions(self):
+ client = self.client(self.admin_app)
+ resp = client.get('/')
+ data = json.loads(resp.body)
+ expected = {
+ "versions": {
+ "values": [{
+ "id": "v2.0",
+ "status": "beta",
+ "updated": "2011-11-19T00:00:00Z",
+ "links": [{
+ "rel": "self",
+ "href": ("http://localhost:%s/v2.0/" %
+ CONF.admin_port),
+ }, {
+ "rel": "describedby",
+ "type": "text/html",
+ "href": "http://docs.openstack.org/api/openstack-"
+ "identity-service/2.0/content/"
+ }, {
+ "rel": "describedby",
+ "type": "application/pdf",
+ "href": "http://docs.openstack.org/api/openstack-"
+ "identity-service/2.0/identity-dev-guide-"
+ "2.0.pdf"
+ }],
+ "media-types": [{
+ "base": "application/json",
+ "type": "application/vnd.openstack.identity-v2.0"
+ "+json"
+ }]
+ }]
+ }
+ }
+ self.assertEqual(data, expected)