Merge "Add extra_specs
to flavor create JSON schema"
This commit is contained in:
commit
e562918d4f
@ -22,6 +22,7 @@ create_flavor = {
|
|||||||
"properties": {
|
"properties": {
|
||||||
'name': parameter_types.name,
|
'name': parameter_types.name,
|
||||||
'description': parameter_types.description,
|
'description': parameter_types.description,
|
||||||
|
'extra_specs': parameter_types.metadata,
|
||||||
'is_public': parameter_types.boolean,
|
'is_public': parameter_types.boolean,
|
||||||
'disabled': parameter_types.boolean,
|
'disabled': parameter_types.boolean,
|
||||||
},
|
},
|
||||||
|
@ -38,15 +38,16 @@ class TestFlavor(v1_test.APITestV1):
|
|||||||
self.post_json('/flavors', body, headers=self.headers, status=201)
|
self.post_json('/flavors', body, headers=self.headers, status=201)
|
||||||
|
|
||||||
def test_flavor_post(self):
|
def test_flavor_post(self):
|
||||||
body = {"name": "test", "description": "just test"}
|
body = {"name": "test", "description": "just test",
|
||||||
|
"extra_specs": {"k1": "v1"}}
|
||||||
resp = self.post_json(
|
resp = self.post_json(
|
||||||
'/flavors', body, headers=self.headers, status=201)
|
'/flavors', body, headers=self.headers, status=201)
|
||||||
resp = resp.json
|
resp = resp.json
|
||||||
self.assertEqual('test', resp['name'])
|
self.assertEqual('test', resp['name'])
|
||||||
self.assertEqual('just test', resp['description'])
|
self.assertEqual('just test', resp['description'])
|
||||||
self.assertEqual(True, resp['is_public'])
|
self.assertEqual(True, resp['is_public'])
|
||||||
|
self.assertEqual({'k1': 'v1'}, resp['extra_specs'])
|
||||||
self.assertIn('uuid', resp)
|
self.assertIn('uuid', resp)
|
||||||
self.assertIn('extra_specs', resp)
|
|
||||||
self.assertIn('links', resp)
|
self.assertIn('links', resp)
|
||||||
|
|
||||||
def test_flavor_get_all(self):
|
def test_flavor_get_all(self):
|
||||||
|
@ -165,6 +165,7 @@ def get_test_flavor(**kw):
|
|||||||
'uuid': kw.get('uuid', uuidutils.generate_uuid()),
|
'uuid': kw.get('uuid', uuidutils.generate_uuid()),
|
||||||
'name': kw.get('name', 'test'),
|
'name': kw.get('name', 'test'),
|
||||||
'description': kw.get('description', 'test'),
|
'description': kw.get('description', 'test'),
|
||||||
|
'extra_specs': kw.get('extra_specs', {}),
|
||||||
'is_public': kw.get('is_public', 1),
|
'is_public': kw.get('is_public', 1),
|
||||||
'disabled': kw.get('disabled', 0),
|
'disabled': kw.get('disabled', 0),
|
||||||
'updated_at': kw.get('updated_at'),
|
'updated_at': kw.get('updated_at'),
|
||||||
|
Loading…
Reference in New Issue
Block a user