Merge "Keypair_id should be a required option when creating a baymodel"

This commit is contained in:
Jenkins 2015-05-12 14:33:47 +00:00 committed by Gerrit Code Review
commit 027a0a3cb9
2 changed files with 8 additions and 1 deletions

View File

@ -75,7 +75,8 @@ class BayModel(base.APIBase):
dns_nameserver = wtypes.IPv4AddressType()
"""The DNS nameserver address"""
keypair_id = wtypes.StringType(min_length=1, max_length=255)
keypair_id = wsme.wsattr(wtypes.StringType(min_length=1, max_length=255),
mandatory=True)
"""The name or id of the nova ssh keypair"""
external_network_id = wtypes.StringType(min_length=1, max_length=255)

View File

@ -505,6 +505,12 @@ class TestPost(api_base.FunctionalTest):
response = self.post_json('/baymodels', cdict, expect_errors=True)
self.assertEqual(400, response.status_int)
def test_create_baymodel_without_keypair_id(self):
cdict = apiutils.baymodel_post_data()
del cdict['keypair_id']
response = self.post_json('/baymodels', cdict, expect_errors=True)
self.assertEqual(400, response.status_int)
class TestDelete(api_base.FunctionalTest):