

def test_group_by_hosts(self):
    'Should group all guests by hosts when called without arguments'
    data = chef.group_nodes_by_host(chef.get_nodes_extended())
    self.assertEqual(len(data), 3)
    for host in data:
        self.assertEqual(host['virtualization']['role'], 'host')
    self.assertEqual(data[2]['name'], 'testnode9')
    vms = data[2]['virtualization']['guests']
    expected_vms = ['testnode1', 'testnode2', 'testnode4']
    self.assertEqual(len(vms), len(expected_vms))
    for vm in vms:
        fqdn = vm['fqdn']
        self.assertTrue((fqdn in expected_vms))
        expected_vms.remove(fqdn)

dataset/ETHPy150Open edelight/kitchen/kitchen/backends/tests.py TestData.test_group_by_hosts/original