Esempio n. 1
0
 def test_required_fields_missing(self):
     body = {'not a node name': 'wibble'}
     data = nodes.NodeData(body)
     self.assertRaises(exc.HTTPBadRequest, data.name)
     self.assertRaises(exc.HTTPBadRequest, data.profile_id)
     self.assertIsNone(data.cluster_id())
     self.assertIsNone(data.role())
     self.assertIsNone(data.metadata())
Esempio n. 2
0
 def test_with_profile_id(self):
     body = {'profile_id': 'my-stack', 'name': 'test_node'}
     data = nodes.NodeData(body)
     self.assertEqual('test_node', data.name())
     self.assertEqual('my-stack', data.profile_id())
Esempio n. 3
0
 def test_with_cluster_id(self):
     body = {'cluster_id': 'cluster-1', 'name': 'test_node'}
     data = nodes.NodeData(body)
     self.assertEqual('test_node', data.name())
     self.assertEqual('cluster-1', data.cluster_id())
Esempio n. 4
0
 def test_node_name(self):
     body = {'name': 'test_node'}
     data = nodes.NodeData(body)
     self.assertEqual('test_node', data.name())