def test_flavor_create_incorrect_param(self):
flavor = self.flavor
flavor.pop('uuid')
# Test invalid value
flavor['properties']['memory']['capacity_mib'] = 10
response = self.app.post('/v1/flavors',
content_type='application/json',
data=json.dumps(self.flavor))
response = json.loads(response.data.decode())
self.assertEqual(http_client.BAD_REQUEST, response['status'])
self.assertEqual('Validation Error', response['title'])
# Test invalid key
flavor['properties']['invalid_key'] = 'invalid'
response = self.app.post('/v1/flavors',
content_type='application/json',
data=json.dumps(self.flavor))
response = json.loads(response.data.decode())
self.assertEqual(http_client.BAD_REQUEST, response['status'])
self.assertEqual('Validation Error', response['title'])
评论列表
文章目录