blob: b0bffc4ff50b878518310a239936d931c2b02e72 [file] [log] [blame]
Jay Pipes13b479b2012-06-11 14:52:27 -04001# vim: tabstop=4 shiftwidth=4 softtabstop=4
2
ZhiQiang Fan39f97222013-09-20 04:49:44 +08003# Copyright 2012 OpenStack Foundation
Jay Pipes13b479b2012-06-11 14:52:27 -04004# All Rights Reserved.
5#
6# Licensed under the Apache License, Version 2.0 (the "License"); you may
7# not use this file except in compliance with the License. You may obtain
8# a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15# License for the specific language governing permissions and limitations
16# under the License.
17
Jay Pipes13b479b2012-06-11 14:52:27 -040018
Sean Dague1937d092013-05-17 16:36:38 -040019from tempest.api.compute import base
ivan-zhu40253442013-11-18 16:31:01 +080020from tempest import test
21import testtools
Jay Pipes13b479b2012-06-11 14:52:27 -040022
23
ivan-zhuf2b00502013-10-18 10:06:52 +080024class ExtensionsTestJSON(base.BaseV2ComputeTest):
Attila Fazekas19044d52013-02-16 07:35:06 +010025 _interface = 'json'
Jay Pipes13b479b2012-06-11 14:52:27 -040026
ivan-zhu40253442013-11-18 16:31:01 +080027 @testtools.skipIf(not test.is_extension_enabled('os-consoles', 'compute'),
28 'os-consoles extension not enabled.')
29 @test.attr(type='gate')
Jay Pipes13b479b2012-06-11 14:52:27 -040030 def test_list_extensions(self):
Sean Dague4dd2c0b2013-01-03 17:50:28 -050031 # List of all extensions
Attila Fazekas19044d52013-02-16 07:35:06 +010032 resp, extensions = self.extensions_client.list_extensions()
Attila Fazekase191cb12013-07-29 06:41:52 +020033 self.assertIn("extensions", extensions)
Jay Pipes13b479b2012-06-11 14:52:27 -040034 self.assertEqual(200, resp.status)
ivan-zhu40253442013-11-18 16:31:01 +080035 self.assertTrue(self.extensions_client.is_enabled("Consoles"))
36
37 @testtools.skipIf(not test.is_extension_enabled('os-consoles', 'compute'),
38 'os-consoles extension not enabled.')
39 @test.attr(type='gate')
40 def test_get_extension(self):
41 # get the specified extensions
42 resp, extension = self.extensions_client.get_extension('os-consoles')
43 self.assertEqual(200, resp.status)
44 self.assertEqual('os-consoles', extension['alias'])
Tiago Mello89126c32012-08-27 11:14:03 -030045
46
Attila Fazekas19044d52013-02-16 07:35:06 +010047class ExtensionsTestXML(ExtensionsTestJSON):
48 _interface = 'xml'