def test_create_ports_two_node_uuids(self):
     port = {'address': 'fake-address', 'node_uuid': 'node-uuid-1'}
     errs = create_resources.create_ports(self.client, [port],
                                          'node-uuid-2')
     self.assertIsInstance(errs[0], exc.ClientException)
     self.assertEqual(1, len(errs))
     self.assertFalse(self.client.port.create.called)
 def test_create_ports_two_node_uuids(self):
     port = {'address': 'fake-address', 'node_uuid': 'node-uuid-1'}
     self.client.port.create.return_value = mock.Mock(uuid='uuid')
     errs = create_resources.create_ports(self.client, [port],
                                          'node-uuid-2')
     self.assertIsInstance(errs[0], exc.ClientException)
     self.assertEqual(1, len(errs))
 def test_create_ports_two_node_uuids(self):
     port = {'address': 'fake-address', 'node_uuid': 'node-uuid-1'}
     errs = create_resources.create_ports(self.client, [port],
                                          'node-uuid-2')
     self.assertIsInstance(errs[0], exc.ClientException)
     self.assertEqual(1, len(errs))
     self.assertFalse(self.client.port.create.called)
 def test_create_ports(self):
     port = {'address': 'fake-address'}
     port_with_node_uuid = port.copy()
     port_with_node_uuid.update(node_uuid='fake-node-uuid')
     self.client.port.create.return_value = mock.Mock(uuid='uuid')
     self.assertEqual([], create_resources.create_ports(self.client, [port],
                                                        'fake-node-uuid'))
     self.client.port.create.assert_called_once_with(**port_with_node_uuid)
 def test_create_ports(self):
     port = {'address': 'fake-address'}
     port_with_node_uuid = port.copy()
     port_with_node_uuid.update(node_uuid='fake-node-uuid')
     self.client.port.create.return_value = mock.Mock(uuid='uuid')
     self.assertEqual([], create_resources.create_ports(self.client, [port],
                                                        'fake-node-uuid'))
     self.client.port.create.assert_called_once_with(**port_with_node_uuid)