Remove v3 references in unit test 'contrib'

This is part of the v3 cleanup effort. References to 'v3' in the code
have been removed; URLs that formerly used '/v3' have been updated to
use '/v2'. Since some of the changes broke some other tests, those
have been updated, too.

Partial-Bug: #1462901
Change-Id: Iba5ef9b0e046e704f7618cb5b748fa28877aeeeb
This commit is contained in:
EdLeafe 2015-08-13 23:32:49 +00:00
parent 2adbc897cc
commit 85cf462313
8 changed files with 153 additions and 172 deletions

View File

@ -57,9 +57,9 @@ class AggregateTestCaseV21(test.NoDBTestCase):
def _set_up(self):
self.controller = aggregates_v21.AggregateController()
self.req = fakes.HTTPRequest.blank('/v3/os-aggregates',
self.req = fakes.HTTPRequest.blank('/v2/os-aggregates',
use_admin_context=True)
self.user_req = fakes.HTTPRequest.blank('/v3/os-aggregates')
self.user_req = fakes.HTTPRequest.blank('/v2/os-aggregates')
self.context = self.req.environ['nova.context']
def setUp(self):

View File

@ -33,7 +33,7 @@ from nova.tests.unit.api.openstack import fakes
class CertificatesTestV21(test.NoDBTestCase):
certificates = certificates_v21
url = '/v3/os-certificates'
url = '/v2/fake/os-certificates'
certificate_show_extension = 'os_compute_api:os-certificates:show'
certificate_create_extension = \
'os_compute_api:os-certificates:create'
@ -115,6 +115,5 @@ class CertificatesTestV21(test.NoDBTestCase):
class CertificatesTestV2(CertificatesTestV21):
certificates = certificates_v2
url = '/v2/fake/os-certificates'
certificate_show_extension = 'compute_extension:certificates'
certificate_create_extension = 'compute_extension:certificates'

View File

@ -113,11 +113,11 @@ def return_flavor_not_found(flavor_id, ctxt=None):
class FlavorsTestV21(test.TestCase):
_prefix = "/v3"
_prefix = "/v2/fake"
Controller = flavors_v21.FlavorsController
fake_request = fakes.HTTPRequestV21
_rspv = "v3"
_fake = ""
_rspv = "v2/fake"
_fake = "/fake"
def setUp(self):
super(FlavorsTestV21, self).setUp()
@ -566,11 +566,8 @@ class FlavorsTestV21(test.TestCase):
class FlavorsTestV20(FlavorsTestV21):
_prefix = "/v2/fake"
Controller = flavors_v2.Controller
fake_request = fakes.HTTPRequest
_rspv = "v2/fake"
_fake = "/fake"
def _set_expected_body(self, expected, ephemeral, swap, disabled):
pass
@ -579,7 +576,7 @@ class FlavorsTestV20(FlavorsTestV21):
class DisabledFlavorsWithRealDBTestV21(test.TestCase):
"""Tests that disabled flavors should not be shown nor listed."""
Controller = flavors_v21.FlavorsController
_prefix = "/v3"
_prefix = "/v2"
fake_request = fakes.HTTPRequestV21
def setUp(self):

View File

@ -51,7 +51,7 @@ class FpingTestV21(test.TestCase):
self.controller = self.controller_cls()
def _get_url(self):
return "/v3"
return "/v2/1234"
def test_fping_index(self):
req = fakes.HTTPRequest.blank(self._get_url() + "/os-fping")
@ -114,9 +114,6 @@ class FpingTestV21(test.TestCase):
class FpingTestV2(FpingTestV21):
controller_cls = fping.FpingController
def _get_url(self):
return "/v2/1234"
class FpingPolicyEnforcementV21(test.NoDBTestCase):

View File

@ -44,8 +44,8 @@ class ImagesControllerTestV21(test.NoDBTestCase):
"""Test of the OpenStack API /images application controller w/Glance.
"""
image_controller_class = images_v21.ImagesController
url_base = '/v3'
bookmark_base = ''
url_base = '/v2/fake'
bookmark_base = '/fake'
http_request = fakes.HTTPRequestV21
def setUp(self):
@ -410,8 +410,6 @@ class ImagesControllerTestV21(test.NoDBTestCase):
class ImagesControllerTestV2(ImagesControllerTestV21):
image_controller_class = images.Controller
url_base = '/v2/fake'
bookmark_base = '/fake'
http_request = fakes.HTTPRequest
def _check_response(self, controller_method, response, expected_code):

File diff suppressed because it is too large Load Diff

View File

@ -36,7 +36,7 @@ def fake_instance_get_by_uuid(context, instance_id,
class ShelvePolicyTestV21(test.NoDBTestCase):
plugin = shelve_v21
prefix = 'v3:os-shelve:'
prefix = 'os_compute_api:os-shelve'
offload = 'shelve_offload'
def setUp(self):

View File

@ -284,7 +284,7 @@ class HTTPRequestV21(os_wsgi.Request):
@staticmethod
def blank(*args, **kwargs):
kwargs['base_url'] = 'http://localhost/v3'
kwargs['base_url'] = 'http://localhost/v2'
use_admin_context = kwargs.pop('use_admin_context', False)
version = kwargs.pop('version', os_wsgi.DEFAULT_API_VERSION)
out = os_wsgi.Request.blank(*args, **kwargs)