remove use of _get_regexes in samples tests
There was an exceptionally large amount of rote use of _get_regexes throughout the samples tests, which doesn't provide any additional explicitness in what's happening, and only couples the tests to the base class in less useful ways. Instead, when we call _verify_response, always also use the base vanilla regexes for matching tests. We also needed to add a few more variables to the list which always need to be reset before testing against the static samples, because uuids are often generated on the fly for the tests. Lastly, test_keypairs needed some test specific surgery. It is so highly normalized (with private test methods that take **kwargs) at this point that it's not really clear that it's testing useful things any more. This really needs denormalization. Change-Id: I165b0f3aa2132373cb59982a5a5ded37b4fa1b52
This commit is contained in:
parent
3dc2055611
commit
ba0339f413
@ -38,29 +38,25 @@ class AggregatesSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
|
||||
"aggregate_id": '(?P<id>\d+)'
|
||||
}
|
||||
response = self._do_post('os-aggregates', 'aggregate-post-req', subs)
|
||||
subs.update(self._get_regexes())
|
||||
return self._verify_response('aggregate-post-resp',
|
||||
subs, response, 200)
|
||||
|
||||
def test_list_aggregates(self):
|
||||
self.test_aggregate_create()
|
||||
response = self._do_get('os-aggregates')
|
||||
subs = self._get_regexes()
|
||||
self._verify_response('aggregates-list-get-resp', subs, response, 200)
|
||||
self._verify_response('aggregates-list-get-resp', {}, response, 200)
|
||||
|
||||
def test_aggregate_get(self):
|
||||
agg_id = self.test_aggregate_create()
|
||||
response = self._do_get('os-aggregates/%s' % agg_id)
|
||||
subs = self._get_regexes()
|
||||
self._verify_response('aggregates-get-resp', subs, response, 200)
|
||||
self._verify_response('aggregates-get-resp', {}, response, 200)
|
||||
|
||||
def test_add_metadata(self):
|
||||
agg_id = self.test_aggregate_create()
|
||||
response = self._do_post('os-aggregates/%s/action' % agg_id,
|
||||
'aggregate-metadata-post-req',
|
||||
{'action': 'set_metadata'})
|
||||
subs = self._get_regexes()
|
||||
self._verify_response('aggregates-metadata-post-resp', subs,
|
||||
self._verify_response('aggregates-metadata-post-resp', {},
|
||||
response, 200)
|
||||
|
||||
def test_add_host(self):
|
||||
@ -70,7 +66,6 @@ class AggregatesSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
|
||||
}
|
||||
response = self._do_post('os-aggregates/%s/action' % aggregate_id,
|
||||
'aggregate-add-host-post-req', subs)
|
||||
subs.update(self._get_regexes())
|
||||
self._verify_response('aggregates-add-host-post-resp', subs,
|
||||
response, 200)
|
||||
|
||||
@ -81,7 +76,6 @@ class AggregatesSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
|
||||
}
|
||||
response = self._do_post('os-aggregates/1/action',
|
||||
'aggregate-remove-host-post-req', subs)
|
||||
subs.update(self._get_regexes())
|
||||
self._verify_response('aggregates-remove-host-post-resp',
|
||||
subs, response, 200)
|
||||
|
||||
@ -89,6 +83,5 @@ class AggregatesSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
|
||||
aggregate_id = self.test_aggregate_create()
|
||||
response = self._do_put('os-aggregates/%s' % aggregate_id,
|
||||
'aggregate-update-post-req', {})
|
||||
subs = self._get_regexes()
|
||||
self._verify_response('aggregate-update-post-resp',
|
||||
subs, response, 200)
|
||||
{}, response, 200)
|
||||
|
Loading…
Reference in New Issue
Block a user