def test_create_single_node_with_portgroups(self):
     params = {'driver': 'fake', 'portgroups': ['some portgroups']}
     self.client.node.create.return_value = mock.Mock(uuid='uuid')
     self.assertEqual(
         ('uuid', None),
         create_resources.create_single_node(self.client, **params))
     self.client.node.create.assert_called_once_with(driver='fake')
 def test_create_single_node_with_portgroups(self):
     params = {'driver': 'fake', 'portgroups': ['some portgroups']}
     self.client.node.create.return_value = mock.Mock(uuid='uuid')
     self.assertEqual(
         ('uuid', None),
         create_resources.create_single_node(self.client, **params)
     )
     self.client.node.create.assert_called_once_with(driver='fake')
 def test_create_single_node_raises_invalid_exception(self):
     params = {'driver': 'fake'}
     e = exc.InvalidAttribute('foo')
     self.client.node.create.side_effect = e
     res, err = create_resources.create_single_node(self.client, **params)
     self.assertIsNone(res)
     self.assertIsInstance(err, exc.InvalidAttribute)
     self.assertIn('Cannot create the node with attributes', str(err))
     self.client.node.create.assert_called_once_with(driver='fake')
 def test_create_single_node_raises_client_exception(self):
     params = {'driver': 'fake'}
     e = exc.ClientException('foo')
     self.client.node.create.side_effect = e
     res, err = create_resources.create_single_node(self.client, **params)
     self.assertIsNone(res)
     self.assertIsInstance(err, exc.ClientException)
     self.assertIn('Unable to create the node', str(err))
     self.client.node.create.assert_called_once_with(driver='fake')
 def test_create_single_node_raises_invalid_exception(self):
     params = {'driver': 'fake'}
     e = exc.InvalidAttribute('foo')
     self.client.node.create.side_effect = e
     res, err = create_resources.create_single_node(self.client, **params)
     self.assertIsNone(res)
     self.assertIsInstance(err, exc.InvalidAttribute)
     self.assertIn('Cannot create the node with attributes', str(err))
     self.client.node.create.assert_called_once_with(driver='fake')
 def test_create_single_node_raises_client_exception(self):
     params = {'driver': 'fake'}
     e = exc.ClientException('foo')
     self.client.node.create.side_effect = e
     res, err = create_resources.create_single_node(self.client, **params)
     self.assertIsNone(res)
     self.assertIsInstance(err, exc.ClientException)
     self.assertIn('Unable to create the node', str(err))
     self.client.node.create.assert_called_once_with(driver='fake')