예제 #1
0
    def setUp(self):
        super(TestApiPaths, self).setUp()
        self.start_servers(**self.__dict__.copy())

        url = 'http://127.0.0.1:%d' % self.api_port
        self.versions = {'versions': tv.get_versions_list(url)}
        images = {'images': []}
        self.images_json = jsonutils.dumps(images)
예제 #2
0
    def test_v2_api_configuration(self):
        self.start_servers(**self.__dict__.copy())

        url = 'http://127.0.0.1:%d' % self.api_port
        versions = {'versions': tv.get_versions_list(url)}

        # Verify version choices returned.
        path = 'http://%s:%d' % ('127.0.0.1', self.api_port)
        http = httplib2.Http()
        response, content_json = http.request(path, 'GET')
        self.assertEqual(http_client.MULTIPLE_CHOICES, response.status)
        content = jsonutils.loads(content_json.decode())
        self.assertEqual(versions, content)
예제 #3
0
    def test_version_configurations(self):
        """Test that versioning is handled properly through all channels"""
        self.start_servers(**self.__dict__.copy())

        url = 'http://127.0.0.1:%d' % self.api_port
        versions = {
            'versions': tv.get_versions_list(url, enabled_backends=True)
        }

        # Verify version choices returned.
        path = 'http://%s:%d' % ('127.0.0.1', self.api_port)
        http = httplib2.Http()
        response, content_json = http.request(path, 'GET')
        self.assertEqual(http_client.MULTIPLE_CHOICES, response.status)
        content = jsonutils.loads(content_json.decode())
        self.assertEqual(versions, content)