Skip to content

Commit 45f1c9c

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Remove unused request API sample template"
2 parents 69def63 + 2ac1bfa commit 45f1c9c

File tree

6 files changed

+17
-17
lines changed

6 files changed

+17
-17
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"evacuate": {
3+
"adminPass": "MySecretPass"
4+
}
5+
}

nova/tests/functional/api_sample_tests/api_samples/consoles/consoles-create-req.json.tpl

Whitespace-only changes.

nova/tests/functional/api_sample_tests/api_samples/os-floating-ips/floating-ips-create-nopool-req.json.tpl

Whitespace-only changes.

nova/tests/functional/api_sample_tests/test_consoles.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ def setUp(self):
3333
self.console = self.start_service('console', host='fake')
3434

3535
def _create_consoles(self, server_uuid):
36-
response = self._do_post('servers/%s/consoles' % server_uuid,
37-
'consoles-create-req', {})
36+
response = self._do_post('servers/%s/consoles' % server_uuid)
3837
self.assertEqual(response.status_code, 200)
3938

4039
def test_create_consoles(self):

nova/tests/functional/api_sample_tests/test_floating_ips.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,21 +60,15 @@ def test_floating_ips_list_empty(self):
6060
{}, response, 200)
6161

6262
def test_floating_ips_list(self):
63-
self._do_post('os-floating-ips',
64-
'floating-ips-create-nopool-req',
65-
{})
66-
self._do_post('os-floating-ips',
67-
'floating-ips-create-nopool-req',
68-
{})
63+
self._do_post('os-floating-ips')
64+
self._do_post('os-floating-ips')
6965

7066
response = self._do_get('os-floating-ips')
7167
self._verify_response('floating-ips-list-resp',
7268
{}, response, 200)
7369

7470
def test_floating_ips_create_nopool(self):
75-
response = self._do_post('os-floating-ips',
76-
'floating-ips-create-nopool-req',
77-
{})
71+
response = self._do_post('os-floating-ips')
7872
self._verify_response('floating-ips-create-resp',
7973
{}, response, 200)
8074

nova/tests/functional/api_samples_test_base.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -495,12 +495,14 @@ def _do_get(self, url, strip_version=False, headers=None,
495495
return jsonutils.loads(response.content)
496496
return response
497497

498-
def _do_post(self, url, name, subs, method='POST', headers=None):
499-
self.subs = subs
500-
body = self._read_template(name) % self.subs
501-
sample = self._get_sample(name, self.microversion)
502-
if self.generate_samples and not os.path.exists(sample):
503-
self._write_sample(name, body)
498+
def _do_post(self, url, name=None, subs=None, method='POST', headers=None):
499+
self.subs = {} if subs is None else subs
500+
body = None
501+
if name:
502+
body = self._read_template(name) % self.subs
503+
sample = self._get_sample(name, self.microversion)
504+
if self.generate_samples and not os.path.exists(sample):
505+
self._write_sample(name, body)
504506
return self._get_response(url, method, body, headers=headers)
505507

506508
def _do_put(self, url, name=None, subs=None, headers=None):

0 commit comments

Comments
 (0)