remove ctype from classes

The ctype class variable in api_samples dates back to when we were
doing both xml and json api testing with them. xml is done, we can
remove all the ctype class variables as they are fully vestigial.

Change-Id: I61361d1d9d3c5b6de38b57aaef16debdba326865
This commit is contained in:
Sean Dague 2015-12-11 09:23:42 -05:00
parent 7974f83743
commit 6272e2a14c
3 changed files with 4 additions and 10 deletions

View File

@ -28,7 +28,6 @@ CONF.import_opt('osapi_compute_extension',
class MigrateServerSamplesJsonTest(test_servers.ServersSampleBase):
extension_name = "os-migrate-server"
ctype = 'json'
def _get_flags(self):
f = super(MigrateServerSamplesJsonTest, self)._get_flags()

View File

@ -23,7 +23,6 @@ CONF.import_opt('osapi_compute_extension',
class SuspendServerSamplesJsonTest(test_servers.ServersSampleBase):
extension_name = "os-suspend-server"
ctype = 'json'
def _get_flags(self):
f = super(SuspendServerSamplesJsonTest, self)._get_flags()

View File

@ -28,7 +28,6 @@ class NoMatch(test.TestingException):
class ApiSampleTestBase(integrated_helpers._IntegratedTestBase):
ctype = 'json'
all_extensions = False
extension_name = None
sample_dir = None
@ -91,7 +90,7 @@ class ApiSampleTestBase(integrated_helpers._IntegratedTestBase):
parts.append(cls.extension_name)
if api_version:
parts.append('v' + api_version)
parts.append(name + "." + cls.ctype + suffix)
parts.append(name + ".json" + suffix)
return os.path.join(*parts)
@classmethod
@ -302,10 +301,7 @@ class ApiSampleTestBase(integrated_helpers._IntegratedTestBase):
return 'http://glance.openstack.example.com'
def _get_regexes(self):
if self.ctype == 'json':
text = r'(\\"|[^"])*'
else:
text = r'[^<]*'
text = r'(\\"|[^"])*'
isotime_re = '\d{4}-[0,1]\d-[0-3]\dT\d{2}:\d{2}:\d{2}Z'
strtime_re = '\d{4}-[0,1]\d-[0-3]\dT\d{2}:\d{2}:\d{2}\.\d{6}'
xmltime_re = ('\d{4}-[0,1]\d-[0-3]\d '
@ -362,8 +358,8 @@ class ApiSampleTestBase(integrated_helpers._IntegratedTestBase):
def _get_response(self, url, method, body=None, strip_version=False,
api_version=None, headers=None):
headers = headers or {}
headers['Content-Type'] = 'application/' + self.ctype
headers['Accept'] = 'application/' + self.ctype
headers['Content-Type'] = 'application/json'
headers['Accept'] = 'application/json'
if api_version:
headers['X-OpenStack-Nova-API-Version'] = api_version
return self.api.api_request(url, body=body, method=method,