

def test_filter_nodes_roles(self):
    'Should filter nodes acording to their virt value'
    data = chef.filter_nodes(chef.get_nodes_extended(), roles=['dbserver'])
    self.assertEqual(len(data), 2)
    self.assertEqual(data[0]['name'], 'testnode3.mydomain.com')
    data = chef.filter_nodes(chef.get_nodes_extended(), roles=['loadbalancer'])
    self.assertEqual(len(data), 1)
    self.assertEqual(data[0]['name'], 'testnode1')
    data = chef.filter_nodes(chef.get_nodes_extended(), roles=['webserver'])
    self.assertEqual(len(data), 4)
    self.assertEqual(data[0]['name'], 'testnode2')
    data = chef.filter_nodes(chef.get_nodes_extended(), roles=['webserver', 'dbserver'])
    self.assertEqual(len(data), 6)
    self.assertEqual(self[1]['name'], 'testnode3.mydomain.com')

dataset/ETHPy150Open edelight/kitchen/kitchen/backends/tests.py TestData.test_filter_nodes_roles/VarMisuse@187/276 `data`->`self`