"Fossies" - the Fresh Open Source Software Archive

Member "zaqar-9.0.0/zaqar/tests/unit/transport/wsgi/test_version.py" (16 Oct 2019, 2293 Bytes) of package /linux/misc/openstack/zaqar-9.0.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 # Copyright (c) 2014 OpenStack Foundation
    2 #
    3 # Licensed under the Apache License, Version 2.0 (the "License");
    4 # you may not use this file except in compliance with the License.
    5 # You may obtain a copy of the License at
    6 #
    7 #    http://www.apache.org/licenses/LICENSE-2.0
    8 #
    9 # Unless required by applicable law or agreed to in writing, software
   10 # distributed under the License is distributed on an "AS IS" BASIS,
   11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
   12 # implied.
   13 # See the License for the specific language governing permissions and
   14 # limitations under the License.
   15 
   16 import falcon
   17 from oslo_serialization import jsonutils
   18 
   19 from zaqar.tests.unit.transport.wsgi import base
   20 
   21 EXPECTED_VERSIONS = [
   22     {
   23         'id': '1',
   24         'status': 'DEPRECATED',
   25         'updated': '2014-9-11T17:47:05Z',
   26         'media-types': [
   27             {
   28                 'base': 'application/json',
   29                 'type': 'application/vnd.openstack.messaging-v1+json'
   30             }
   31         ],
   32         'links': [
   33             {
   34                 'href': '/v1/',
   35                 'rel': 'self'
   36             }
   37         ]
   38     },
   39     {
   40         'id': '1.1',
   41         'status': 'DEPRECATED',
   42         'updated': '2016-7-29T02:22:47Z',
   43         'media-types': [
   44             {
   45                 'base': 'application/json',
   46                 'type': 'application/vnd.openstack.messaging-v1_1+json'
   47             }
   48         ],
   49         'links': [
   50             {
   51                 'href': '/v1.1/',
   52                 'rel': 'self'
   53             }
   54         ]
   55     },
   56     {
   57         'id': '2',
   58         'status': 'CURRENT',
   59         'updated': '2014-9-24T04:06:47Z',
   60         'media-types': [
   61             {
   62                 'base': 'application/json',
   63                 'type': 'application/vnd.openstack.messaging-v2+json'
   64             }
   65         ],
   66         'links': [
   67             {
   68                 'href': '/v2/',
   69                 'rel': 'self'
   70             }
   71         ]
   72     }
   73 ]
   74 
   75 
   76 class TestVersion(base.TestBase):
   77 
   78     config_file = 'wsgi_mongodb.conf'
   79 
   80     def test_get(self):
   81         response = self.simulate_get('/')
   82         versions = jsonutils.loads(response[0])['versions']
   83 
   84         self.assertEqual(falcon.HTTP_300, self.srmock.status)
   85         self.assertEqual(3, len(versions))
   86         self.assertEqual(EXPECTED_VERSIONS, versions)