Commit 1f8fd9b2 authored by Giorgos Verigakis's avatar Giorgos Verigakis
Browse files

Fix API calls that depend on specific server ids

Fixes #417
parent 92169f23
......@@ -604,15 +604,17 @@ class CreateServerMetadataItem(BaseTestCase):
self.assertItemNotFound(response)
def test_invalid_key(self):
with AssertInvariant(self.get_all_server_metadata):
path = '/api/v1.1/servers/1/meta/baz'
with AssertInvariant(self.get_all_server_metadata) as metadata:
server_id = choice(metadata.keys())
path = '/api/v1.1/servers/%d/meta/baz' % server_id
data = json.dumps({'meta': {'foo': 'bar'}})
response = self.client.put(path, data, content_type='application/json')
self.assertBadRequest(response)
def test_invalid_data(self):
with AssertInvariant(self.get_all_server_metadata):
path = '/api/v1.1/servers/1/meta/foo'
with AssertInvariant(self.get_all_server_metadata) as metadata:
server_id = choice(metadata.keys())
path = '/api/v1.1/servers/%d/meta/foo' % server_id
response = self.client.put(path, 'meta', content_type='application/json')
self.assertBadRequest(response)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment