Ejemplo n.º 1
0
 def test_check_version_too_low(self):
     self.version.major = v1_api.BASE_VERSION
     self.version.minor = v1_api.min_version().minor - 1
     self.assertRaises(
         webob_exc.HTTPNotAcceptable,
         v1_api.Controller()._check_version,
         self.version)
Ejemplo n.º 2
0
 def test_get_one_invalid_api_version_without_check(self):
     # Invalid name, but the check happens after the microversion check.
     response = self.get_json(
         '/allocations/ba!na!na!',
         headers={api_base.Version.string: str(api_v1.min_version())},
         expect_errors=True)
     self.assertEqual(http_client.NOT_FOUND, response.status_int)
Ejemplo n.º 3
0
 def test_get_by_node_resource_invalid_api_version(self):
     obj_utils.create_test_allocation(self.context, node_id=self.node.id)
     response = self.get_json(
         '/nodes/%s/allocation' % self.node.uuid,
         headers={api_base.Version.string: str(api_v1.min_version())},
         expect_errors=True)
     self.assertEqual(http_client.NOT_FOUND, response.status_int)
Ejemplo n.º 4
0
 def test_detail_using_query_old_version(self):
     obj_utils.create_test_chassis(self.context)
     response = self.get_json(
         '/chassis?detail=True',
         headers={api_base.Version.string: str(api_v1.min_version())},
         expect_errors=True)
     self.assertEqual(http_client.BAD_REQUEST, response.status_int)
Ejemplo n.º 5
0
 def test_detail_using_query_old_version(self):
     obj_utils.create_test_chassis(self.context)
     response = self.get_json(
         '/chassis?detail=True',
         headers={api_base.Version.string: str(api_v1.min_version())},
         expect_errors=True)
     self.assertEqual(http_client.BAD_REQUEST, response.status_int)
Ejemplo n.º 6
0
 def test_create_volume_target_invalid_api_version(self):
     pdict = post_get_test_volume_target()
     response = self.post_json(
         '/volume/targets', pdict,
         headers={api_base.Version.string: str(api_v1.min_version())},
         expect_errors=True)
     self.assertEqual(http_client.NOT_FOUND, response.status_int)
Ejemplo n.º 7
0
 def test_check_version_too_low(self):
     self.version.major = v1_api.BASE_VERSION
     self.version.minor = v1_api.min_version().minor - 1
     self.assertRaises(
         webob_exc.HTTPNotAcceptable,
         v1_api.Controller()._check_version,
         self.version)
Ejemplo n.º 8
0
 def test_create_volume_target_invalid_api_version(self):
     pdict = post_get_test_volume_target()
     response = self.post_json(
         '/volume/targets', pdict,
         headers={api_base.Version.string: str(api_v1.min_version())},
         expect_errors=True)
     self.assertEqual(http_client.NOT_FOUND, response.status_int)
Ejemplo n.º 9
0
 def test_old_api_version(self):
     response = self.post_json(
         '/heartbeat/%s' % uuidutils.generate_uuid(),
         {'callback_url': 'url'},
         headers={api_base.Version.string: str(api_v1.min_version())},
         expect_errors=True)
     self.assertEqual(http_client.NOT_FOUND, response.status_int)
Ejemplo n.º 10
0
 def test_get_by_node_resource_invalid_api_version(self):
     obj_utils.create_test_allocation(self.context, node_id=self.node.id)
     response = self.get_json(
         '/nodes/%s/allocation' % self.node.uuid,
         headers={api_base.Version.string: str(api_v1.min_version())},
         expect_errors=True)
     self.assertEqual(http_client.NOT_FOUND, response.status_int)
Ejemplo n.º 11
0
 def test_get_one_invalid_api_version_without_check(self):
     # Invalid name, but the check happens after the microversion check.
     response = self.get_json(
         '/allocations/ba!na!na!',
         headers={api_base.Version.string: str(api_v1.min_version())},
         expect_errors=True)
     self.assertEqual(http_client.NOT_FOUND, response.status_int)
Ejemplo n.º 12
0
 def test_one_invalid_api_version(self):
     obj_utils.create_test_volume_target(self.context, node_id=self.node.id)
     response = self.get_json(
         '/volume/targets',
         headers={api_base.Version.string: str(api_v1.min_version())},
         expect_errors=True)
     self.assertEqual(http_client.NOT_FOUND, response.status_int)
Ejemplo n.º 13
0
 def test_one_invalid_api_version(self):
     obj_utils.create_test_volume_target(
         self.context, node_id=self.node.id)
     response = self.get_json(
         '/volume/targets',
         headers={api_base.Version.string: str(api_v1.min_version())},
         expect_errors=True)
     self.assertEqual(http_client.NOT_FOUND, response.status_int)
Ejemplo n.º 14
0
 def test_delete_allocation_by_node_invalid_api_version(self, mock_destroy):
     obj_utils.create_test_allocation(self.context, node_id=self.node.id)
     response = self.delete(
         '/nodes/%s/allocation' % self.node.uuid,
         headers={api_base.Version.string: str(api_v1.min_version())},
         expect_errors=True)
     self.assertEqual(http_client.NOT_FOUND, response.status_int)
     self.assertFalse(mock_destroy.called)
Ejemplo n.º 15
0
 def test_delete_allocation_by_node_invalid_api_version(self, mock_destroy):
     obj_utils.create_test_allocation(self.context, node_id=self.node.id)
     response = self.delete(
         '/nodes/%s/allocation' % self.node.uuid,
         headers={api_base.Version.string: str(api_v1.min_version())},
         expect_errors=True)
     self.assertEqual(http_client.NOT_FOUND, response.status_int)
     self.assertFalse(mock_destroy.called)
Ejemplo n.º 16
0
 def test_get_custom_fields_invalid_api_version(self):
     chassis = obj_utils.create_test_chassis(self.context)
     fields = 'uuid,extra'
     response = self.get_json(
         '/chassis/%s?fields=%s' % (chassis.uuid, fields),
         headers={api_base.Version.string: str(api_v1.min_version())},
         expect_errors=True)
     self.assertEqual(http_client.NOT_ACCEPTABLE, response.status_int)
Ejemplo n.º 17
0
 def test_get_custom_fields_invalid_api_version(self):
     chassis = obj_utils.create_test_chassis(self.context)
     fields = 'uuid,extra'
     response = self.get_json(
         '/chassis/%s?fields=%s' % (chassis.uuid, fields),
         headers={api_base.Version.string: str(api_v1.min_version())},
         expect_errors=True)
     self.assertEqual(http_client.NOT_ACCEPTABLE, response.status_int)
Ejemplo n.º 18
0
 def test_get_custom_fields_invalid_api_version(self):
     connector = obj_utils.create_test_volume_connector(
         self.context, node_id=self.node.id)
     fields = 'uuid,extra'
     response = self.get_json(
         '/volume/connectors/%s?fields=%s' % (connector.uuid, fields),
         headers={api_base.Version.string: str(api_v1.min_version())},
         expect_errors=True)
     self.assertEqual(http_client.NOT_FOUND, response.status_int)
Ejemplo n.º 19
0
    def test_old_api_version(self):
        obj_utils.create_test_port(self.context,
                                   node_id=self.node.id,
                                   address=self.addresses[1])

        response = self.get_json(
            '/lookup?addresses=%s' % ','.join(self.addresses),
            headers={api_base.Version.string: str(api_v1.min_version())},
            expect_errors=True)
        self.assertEqual(http_client.NOT_FOUND, response.status_int)
Ejemplo n.º 20
0
 def test_update_byid_invalid_api_version(self, mock_upd):
     headers = {api_base.Version.string: str(api_v1.min_version())}
     response = self.patch_json('/volume/targets/%s'
                                % self.target.uuid,
                                [{'path': '/extra/foo',
                                  'value': 'bar',
                                  'op': 'add'}],
                                headers=headers,
                                expect_errors=True)
     self.assertEqual(http_client.NOT_FOUND, response.status_int)
Ejemplo n.º 21
0
 def test_update_byid_invalid_api_version(self, mock_upd):
     headers = {api_base.Version.string: str(api_v1.min_version())}
     response = self.patch_json('/volume/targets/%s'
                                % self.target.uuid,
                                [{'path': '/extra/foo',
                                  'value': 'bar',
                                  'op': 'add'}],
                                headers=headers,
                                expect_errors=True)
     self.assertEqual(http_client.NOT_FOUND, response.status_int)
Ejemplo n.º 22
0
 def test_get_volume_invalid_api_version(self):
     headers = {api_base.Version.string: str(api_v1.min_version())}
     response = self.get_json('/volume/', headers=headers,
                              expect_errors=True)
     self.assertEqual(http_client.NOT_FOUND, response.status_int)
Ejemplo n.º 23
0
 def test_get_volume_invalid_api_version(self):
     headers = {api_base.Version.string: str(api_v1.min_version())}
     response = self.get_json('/volume/',
                              headers=headers,
                              expect_errors=True)
     self.assertEqual(http_client.NOT_FOUND, response.status_int)
Ejemplo n.º 24
0
 def test_delete_volume_connector_byid_invalid_api_version(self, mock_dvc):
     headers = {api_base.Version.string: str(api_v1.min_version())}
     response = self.delete('/volume/connectors/%s' % self.connector.uuid,
                            expect_errors=True,
                            headers=headers)
     self.assertEqual(http_client.NOT_FOUND, response.status_int)
Ejemplo n.º 25
0
 def test_check_version_ok(self):
     self.version.major = v1_api.BASE_VERSION
     self.version.minor = v1_api.min_version().minor
     v1_api.Controller()._check_version(self.version)
Ejemplo n.º 26
0
 def test_delete_volume_target_byid_invalid_api_version(self, mock_dvc):
     headers = {api_base.Version.string: str(api_v1.min_version())}
     response = self.delete('/volume/targets/%s' % self.target.uuid,
                            headers=headers,
                            expect_errors=True)
     self.assertEqual(http_client.NOT_FOUND, response.status_int)
Ejemplo n.º 27
0
 def test_check_version_ok(self):
     self.version.major = v1_api.BASE_VERSION
     self.version.minor = v1_api.min_version().minor
     v1_api.Controller()._check_version(self.version)