Adds test cases for servers in designateclient

This patch adds test cases for servers module of

v1 client.

Change-Id: I3576962d03a8da88ed5bf105ff2c7a5c32aff43c
This commit is contained in:
sonu.kumar 2015-09-29 14:42:45 +05:30
parent f2192badc1
commit 3f8ab7772d

View File

@ -64,6 +64,18 @@ class TestServers(test_v1.APIV1TestCase, test_v1.CrudMixin):
self.client.servers.create({"name": "ns1.example.org."})
self.assertRequestBodyIs(json=values)
def test_create_with_name_too_long(self):
ref = {"id": "89acac79-38e7-497d-807c-a011e1310438",
"name": "ns1." + "foo" * 85 + ".org."}
self.stub_url("POST", parts=[self.RESOURCE], json=ref)
values = ref.copy()
del values["id"]
self.assertRaises(ValueError, self.client.servers.create,
{"name": "ns1.example.org."})
@patch.object(servers.ServersController, "update")
def test_update(self, server_update):
ref = self.new_ref()