Exemplo n.º 1
0
 def test_list(self):
     self.cloud.list_ports.return_value = [
         {'device_owner': 'network:dhcp'},
         {'device_owner': 'network:router_interface'},
         {'device_owner': ''}
     ]
     ports = neutron.Ports(self.creds_manager).list()
     self.assertEqual([{'device_owner': ''}], ports)
     self.cloud.list_ports.assert_called_once_with(
         filters={'tenant_id': self.creds_manager.project_id})
Exemplo n.º 2
0
 def test_to_string(self):
     port = mock.MagicMock()
     self.assertIn("Port (",
                   neutron.Ports(self.creds_manager).to_str(port))
Exemplo n.º 3
0
 def test_delete(self):
     port = mock.MagicMock()
     self.assertIsNone(neutron.Ports(self.creds_manager).delete(port))
     self.cloud.delete_port.assert_called_once_with(port['id'])
Exemplo n.º 4
0
 def test_disable(self):
     port = mock.MagicMock()
     self.assertIsNone(neutron.Ports(self.creds_manager).disable(port))
     self.cloud.update_port.assert_called_once_with(port['id'],
                                                    admin_state_up=False)