def test_check_prerequisite(self): self.cloud.list_servers.return_value = ['vm1'] self.assertEqual( False, neutron.FloatingIPs(self.creds_manager).check_prerequisite()) self.cloud.list_servers.return_value = [] self.assertEqual( True, neutron.FloatingIPs(self.creds_manager).check_prerequisite())
def test_to_string(self): fip = mock.MagicMock() self.assertIn("Floating IP ", neutron.FloatingIPs(self.creds_manager).to_str(fip))
def test_delete(self): fip = mock.MagicMock() self.assertIsNone(neutron.FloatingIPs(self.creds_manager).delete(fip)) self.cloud.delete_floating_ip.assert_called_once_with( fip['id'])
def test_list(self): self.assertIs(self.cloud.search_floating_ips.return_value, neutron.FloatingIPs(self.creds_manager).list()) self.cloud.search_floating_ips.assert_called_once_with( filters={'tenant_id': self.creds_manager.project_id} )
def test_disable(self): fip = mock.MagicMock() self.assertIsNone(neutron.FloatingIPs(self.creds_manager).disable(fip)) self.cloud.network.update_ip.assert_called_once_with(fip['id'], port_id=None)