diff --git a/cloudcafe/compute/unit/models/test_hosts.py b/cloudcafe/compute/unit/models/test_hosts.py
index 80ede68a..c94ecd38 100644
--- a/cloudcafe/compute/unit/models/test_hosts.py
+++ b/cloudcafe/compute/unit/models/test_hosts.py
@@ -5,23 +5,35 @@ from cloudcafe.compute.hosts_api.models.hosts import Host
class HostDomainTest(object):
- def test_host_name(self):
- self.assertEqual(self.host.name, "host_name")
+ def test_resource_length(self):
+ self.assertTrue(len(self.host.resources) > 0)
- def test_host_service(self):
- self.assertEqual(self.host.service, "compute")
+ def test_host_resource_cpu(self):
+ self.assertEqual(self.host.resources[0].cpu, "1")
- def test_host_zone(self):
- self.assertEqual(self.host.zone, "nova")
+ def test_host_resource_disk(self):
+ self.assertEqual(self.host.resources[0].disk_gb, "1028")
+
+ def test_resource_host_name(self):
+ self.assertEqual(self.host.resources[0].host, "nova")
+
+ def test_host_resource_memory(self):
+ self.assertEqual(self.host.resources[0].memory_mb, "8192")
+
+ def test_host_resource_project(self):
+ self.assertEqual(self.host.resources[0].project, "(total)")
class HostDomainJSONTest(unittest.TestCase, HostDomainTest):
@classmethod
def setUp(cls):
- cls.host_json = '{"host":{"host_name":' \
- ' "host_name","service":' \
- ' "compute","zone": "nova"}}'
+ cls.host_json = '{"host":[{"resource":' \
+ '{"cpu": "1",' \
+ '"disk_gb": "1028", ' \
+ ' "host": "nova", ' \
+ '"memory_mb": "8192", ' \
+ '"project": "(total)"}}]}'
cls.host = Host.deserialize(cls.host_json, "json")
@@ -30,8 +42,13 @@ class HostDomainXMLTest(unittest.TestCase, HostDomainTest):
@classmethod
def setUp(cls):
cls.host_xml = '' \
- ''
+ ' ' \
+ ' (total)' \
+ ' 8192' \
+ ' nova 1' \
+ ' 1028' \
+ ' '
+
cls.host = Host.deserialize(cls.host_xml, "xml")
@@ -41,8 +58,8 @@ class HostDomainCollectionTest(object):
self.assertEqual(len(self.hosts), 2)
def test_host_names(self):
- self.assertEqual(self.hosts[0].name, "host_name1")
- self.assertEqual(self.hosts[1].name, "host_name2")
+ self.assertEqual(self.hosts[0].host_name, "host_name1")
+ self.assertEqual(self.hosts[1].host_name, "host_name2")
def test_host_services(self):
self.assertEqual(self.hosts[0].service, "compute1")
@@ -59,11 +76,11 @@ class HostDomainCollectionJSONTest(unittest.TestCase,
@classmethod
def setUp(cls):
cls.hosts_json = '{"hosts":' \
- '[{"host":{"host_name":' \
+ '[{"host_name":' \
' "host_name1","service": "compute1",' \
- '"zone": "nova1"}},' \
- '{"host":{"host_name": "host_name2",' \
- '"service": "compute2","zone": "nova2"}}]}'
+ '"zone": "nova1"},' \
+ '{"host_name": "host_name2",' \
+ '"service": "compute2","zone": "nova2"}]}'
cls.hosts = Host.deserialize(cls.hosts_json, "json")