summaryrefslogtreecommitdiff
path: root/openstack_dashboard/dashboards
diff options
context:
space:
mode:
authorAkihiro Motoki <amotoki@gmail.com>2022-01-27 03:20:36 +0900
committerAkihiro Motoki <amotoki@gmail.com>2022-02-04 16:27:18 +0900
commite4444e69790a117ef821e0a9af3dcff4e16095eb (patch)
tree2586c4663072af439fe7c9eb84c3e0d4ea4ab74d /openstack_dashboard/dashboards
parentd9266fd82c1f0acc6b7236a6dc9b7e510985eb13 (diff)
downloadhorizon-e4444e69790a117ef821e0a9af3dcff4e16095eb.tar.gz
Address RemovedInDjango40Warning (4)
In Django 3.0, django.utils.http.urlquote(), urlquote_plus(), urlunquote(), and urlunquote_plus() are deprecated in favor of the functions that they’re aliases for: urllib.parse.quote(), quote_plus(), unquote(), and unquote_plus(). https: //docs.djangoproject.com/en/4.0/releases/3.0/ Change-Id: I37fcd917cbf87b4d3141cfbdd2675aa38f33f2a4
Diffstat (limited to 'openstack_dashboard/dashboards')
-rw-r--r--openstack_dashboard/dashboards/admin/backups/tests.py5
-rw-r--r--openstack_dashboard/dashboards/admin/networks/subnets/tests.py6
-rw-r--r--openstack_dashboard/dashboards/admin/networks/tests.py26
-rw-r--r--openstack_dashboard/dashboards/admin/snapshots/tests.py6
-rw-r--r--openstack_dashboard/dashboards/admin/volumes/tests.py4
-rw-r--r--openstack_dashboard/dashboards/project/backups/tests.py5
-rw-r--r--openstack_dashboard/dashboards/project/networks/tests.py26
-rw-r--r--openstack_dashboard/dashboards/project/snapshots/tests.py4
-rw-r--r--openstack_dashboard/dashboards/project/volume_groups/tests.py6
-rw-r--r--openstack_dashboard/dashboards/project/volumes/tests.py4
10 files changed, 47 insertions, 45 deletions
diff --git a/openstack_dashboard/dashboards/admin/backups/tests.py b/openstack_dashboard/dashboards/admin/backups/tests.py
index 060614636..c247ab460 100644
--- a/openstack_dashboard/dashboards/admin/backups/tests.py
+++ b/openstack_dashboard/dashboards/admin/backups/tests.py
@@ -10,11 +10,12 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse
+
from django.conf import settings
from django.test.utils import override_settings
from django.urls import reverse
from django.utils.http import urlencode
-from django.utils.http import urlunquote
from openstack_dashboard import api
from openstack_dashboard.dashboards.admin.backups \
@@ -40,7 +41,7 @@ class AdminVolumeBackupsViewTests(test.BaseAdminViewTests):
= self.cinder_volume_snapshots.list()
self.mock_tenant_list.return_value = [self.tenants.list(), False]
- res = self.client.get(urlunquote(url))
+ res = self.client.get(parse.unquote(url))
self.assertEqual(res.status_code, 200)
self.assertTemplateUsed(res, 'horizon/common/_data_table_view.html')
diff --git a/openstack_dashboard/dashboards/admin/networks/subnets/tests.py b/openstack_dashboard/dashboards/admin/networks/subnets/tests.py
index 155054356..4f9478d53 100644
--- a/openstack_dashboard/dashboards/admin/networks/subnets/tests.py
+++ b/openstack_dashboard/dashboards/admin/networks/subnets/tests.py
@@ -15,6 +15,7 @@
import collections
from unittest import mock
+from urllib import parse
from django.urls import reverse
@@ -410,9 +411,8 @@ class NetworkSubnetTests(test.BaseAdminViewTests):
self.mock_subnet_list.return_value = [self.subnets.first()]
self.mock_tenant_quota_usages.return_value = quota_data
- from django.utils.http import urlunquote
- url = urlunquote(reverse('horizon:admin:networks:subnets_tab',
- args=[network.id]))
+ url = parse.unquote(reverse('horizon:admin:networks:subnets_tab',
+ args=[network.id]))
res = self.client.get(url)
self.assertTemplateUsed(res, 'horizon/common/_detail.html')
subnets = res.context['subnets_table'].data
diff --git a/openstack_dashboard/dashboards/admin/networks/tests.py b/openstack_dashboard/dashboards/admin/networks/tests.py
index 3c34ad8fa..db1f4f0e7 100644
--- a/openstack_dashboard/dashboards/admin/networks/tests.py
+++ b/openstack_dashboard/dashboards/admin/networks/tests.py
@@ -14,9 +14,9 @@
import collections
from unittest import mock
+from urllib import parse
from django.urls import reverse
-from django.utils.http import urlunquote
from horizon import forms
@@ -119,8 +119,8 @@ class NetworkTests(test.BaseAdminViewTests):
'mac-learning': mac_learning,
'dhcp_agent_scheduler': True})
- url = urlunquote(reverse('horizon:admin:networks:detail',
- args=[network.id]))
+ url = parse.unquote(reverse('horizon:admin:networks:detail',
+ args=[network.id]))
res = self.client.get(url)
network = res.context['network']
@@ -167,8 +167,8 @@ class NetworkTests(test.BaseAdminViewTests):
'dhcp_agent_scheduler': True})
self.mock_tenant_quota_usages.return_value = quota_data
- url = urlunquote(reverse('horizon:admin:networks:subnets_tab',
- args=[network.id]))
+ url = parse.unquote(reverse('horizon:admin:networks:subnets_tab',
+ args=[network.id]))
res = self.client.get(url)
self.assertTemplateUsed(res, 'horizon/common/_detail.html')
@@ -211,7 +211,7 @@ class NetworkTests(test.BaseAdminViewTests):
url = reverse('horizon:admin:networks:ports_tab',
args=[network.id])
- res = self.client.get(urlunquote(url))
+ res = self.client.get(parse.unquote(url))
self.assertTemplateUsed(res, 'horizon/common/_detail.html')
ports = res.context['ports_table'].data
@@ -256,7 +256,7 @@ class NetworkTests(test.BaseAdminViewTests):
self.mock_tenant_quota_usages.return_value = quota_data
url = reverse('horizon:admin:networks:agents_tab', args=[network.id])
- res = self.client.get(urlunquote(url))
+ res = self.client.get(parse.unquote(url))
self.assertTemplateUsed(res, 'horizon/common/_detail.html')
result_agents = res.context['agents_table'].data
@@ -300,8 +300,8 @@ class NetworkTests(test.BaseAdminViewTests):
{'network-ip-availability': True,
'mac-learning': mac_learning})
- url = urlunquote(reverse('horizon:admin:networks:subnets_tab',
- args=[network_id]))
+ url = parse.unquote(reverse('horizon:admin:networks:subnets_tab',
+ args=[network_id]))
res = self.client.get(url)
redir_url = INDEX_URL
@@ -345,8 +345,8 @@ class NetworkTests(test.BaseAdminViewTests):
'network_availability_zone': True})
self.mock_tenant_quota_usages.return_value = quota_data
- url = urlunquote(reverse('horizon:admin:networks:subnets_tab',
- args=[network.id]))
+ url = parse.unquote(reverse('horizon:admin:networks:subnets_tab',
+ args=[network.id]))
res = self.client.get(url)
self.assertTemplateUsed(res, 'horizon/common/_detail.html')
@@ -397,8 +397,8 @@ class NetworkTests(test.BaseAdminViewTests):
'dhcp_agent_scheduler': True})
self.mock_tenant_quota_usages.return_value = quota_data
- url = urlunquote(reverse('horizon:admin:networks:subnets_tab',
- args=[network.id]))
+ url = parse.unquote(reverse('horizon:admin:networks:subnets_tab',
+ args=[network.id]))
res = self.client.get(url)
self.assertTemplateUsed(res, 'horizon/common/_detail.html')
diff --git a/openstack_dashboard/dashboards/admin/snapshots/tests.py b/openstack_dashboard/dashboards/admin/snapshots/tests.py
index c1f7b8cf7..e04a05e8b 100644
--- a/openstack_dashboard/dashboards/admin/snapshots/tests.py
+++ b/openstack_dashboard/dashboards/admin/snapshots/tests.py
@@ -11,11 +11,11 @@
# under the License.
from unittest import mock
+from urllib import parse
from django.conf import settings
from django.test.utils import override_settings
from django.urls import reverse
-from django.utils.http import urlunquote
from openstack_dashboard.api import cinder
from openstack_dashboard.api import keystone
@@ -38,7 +38,7 @@ class VolumeSnapshotsViewTests(test.BaseAdminViewTests):
self.mock_tenant_list.return_value = [self.tenants.list(), False]
url = reverse(INDEX_URL)
- res = self.client.get(urlunquote(url))
+ res = self.client.get(parse.unquote(url))
self.assertEqual(res.status_code, 200)
self.assertTemplateUsed(res, 'horizon/common/_data_table_view.html')
@@ -63,7 +63,7 @@ class VolumeSnapshotsViewTests(test.BaseAdminViewTests):
self.mock_volume_list.return_value = self.cinder_volumes.list()
self.mock_tenant_list.return_value = [self.tenants.list(), False]
- res = self.client.get(urlunquote(url))
+ res = self.client.get(parse.unquote(url))
self.assertTemplateUsed(res, 'horizon/common/_data_table_view.html')
self.assertEqual(res.status_code, 200)
diff --git a/openstack_dashboard/dashboards/admin/volumes/tests.py b/openstack_dashboard/dashboards/admin/volumes/tests.py
index 29a39649b..37495cad9 100644
--- a/openstack_dashboard/dashboards/admin/volumes/tests.py
+++ b/openstack_dashboard/dashboards/admin/volumes/tests.py
@@ -13,11 +13,11 @@
# under the License.
import copy
+from urllib import parse
from django.conf import settings
from django.test.utils import override_settings
from django.urls import reverse
-from django.utils.http import urlunquote
from openstack_dashboard import api
from openstack_dashboard.dashboards.project.volumes \
@@ -92,7 +92,7 @@ class VolumeTests(test.BaseAdminViewTests):
self.mock_server_list.return_value = [self.servers.list(), False]
self.mock_tenant_list.return_value = [self.tenants.list(), False]
- res = self.client.get(urlunquote(url))
+ res = self.client.get(parse.unquote(url))
self.mock_server_list.assert_called_once_with(
test.IsHttpRequest(), search_opts={'all_tenants': True})
diff --git a/openstack_dashboard/dashboards/project/backups/tests.py b/openstack_dashboard/dashboards/project/backups/tests.py
index a3616fe0b..4a93d782a 100644
--- a/openstack_dashboard/dashboards/project/backups/tests.py
+++ b/openstack_dashboard/dashboards/project/backups/tests.py
@@ -10,11 +10,12 @@
# License for the specific language governing permissions and limitations
# under the License.
+from urllib import parse
+
from django.conf import settings
from django.test.utils import override_settings
from django.urls import reverse
from django.utils.http import urlencode
-from django.utils.http import urlunquote
from openstack_dashboard import api
from openstack_dashboard.dashboards.project.backups \
@@ -39,7 +40,7 @@ class VolumeBackupsViewTests(test.TestCase):
self.mock_volume_snapshot_list.return_value \
= self.cinder_volume_snapshots.list()
- res = self.client.get(urlunquote(url))
+ res = self.client.get(parse.unquote(url))
self.assertEqual(res.status_code, 200)
self.assertTemplateUsed(res, 'horizon/common/_data_table_view.html')
diff --git a/openstack_dashboard/dashboards/project/networks/tests.py b/openstack_dashboard/dashboards/project/networks/tests.py
index dc53c9b99..d50550bdc 100644
--- a/openstack_dashboard/dashboards/project/networks/tests.py
+++ b/openstack_dashboard/dashboards/project/networks/tests.py
@@ -14,10 +14,10 @@
import collections
from unittest import mock
+from urllib import parse
from django.urls import reverse
from django.utils.html import escape
-from django.utils.http import urlunquote
from horizon.workflows import views
@@ -200,8 +200,8 @@ class NetworkTests(test.TestCase, NetworkStubMixin):
self._stub_is_extension_supported({'mac-learning': mac_learning,
'network_availability_zone': True})
- url = urlunquote(reverse('horizon:project:networks:detail',
- args=[network_id]))
+ url = parse.unquote(reverse('horizon:project:networks:detail',
+ args=[network_id]))
res = self.client.get(url)
network = res.context['network']
@@ -234,8 +234,8 @@ class NetworkTests(test.TestCase, NetworkStubMixin):
self._stub_is_extension_supported({'mac-learning': mac_learning,
'network_availability_zone': True})
- url = urlunquote(reverse('horizon:project:networks:subnets_tab',
- args=[network_id]))
+ url = parse.unquote(reverse('horizon:project:networks:subnets_tab',
+ args=[network_id]))
res = self.client.get(url)
self.assertTemplateUsed(res, 'horizon/common/_detail.html')
@@ -304,8 +304,8 @@ class NetworkTests(test.TestCase, NetworkStubMixin):
self._stub_is_extension_supported({'mac-learning': mac_learning,
'network_availability_zone': True})
- url = urlunquote(reverse('horizon:project:networks:subnets_tab',
- args=[network_id]))
+ url = parse.unquote(reverse('horizon:project:networks:subnets_tab',
+ args=[network_id]))
res = self.client.get(url)
self.assertTemplateUsed(res, 'horizon/common/_detail.html')
@@ -345,8 +345,8 @@ class NetworkTests(test.TestCase, NetworkStubMixin):
self._stub_is_extension_supported({'mac-learning': mac_learning,
'network_availability_zone': True})
- url = urlunquote(reverse('horizon:project:networks:subnets_tab',
- args=[network_id]))
+ url = parse.unquote(reverse('horizon:project:networks:subnets_tab',
+ args=[network_id]))
res = self.client.get(url)
self.assertTemplateUsed(res, 'horizon/common/_detail.html')
subnets = res.context['subnets_table'].data
@@ -1248,8 +1248,8 @@ class NetworkViewTests(test.TestCase, NetworkStubMixin):
'network_availability_zone': True})
self.mock_tenant_quota_usages.return_value = quota_data
- url = urlunquote(reverse('horizon:project:networks:subnets_tab',
- args=[network_id]))
+ url = parse.unquote(reverse('horizon:project:networks:subnets_tab',
+ args=[network_id]))
res = self.client.get(url)
self.assertTemplateUsed(res, 'horizon/common/_detail.html')
@@ -1320,8 +1320,8 @@ class NetworkViewTests(test.TestCase, NetworkStubMixin):
'network_availability_zone': True})
self.mock_tenant_quota_usages.return_value = quota_data
- url = urlunquote(reverse('horizon:project:networks:ports_tab',
- args=[network_id]))
+ url = parse.unquote(reverse('horizon:project:networks:ports_tab',
+ args=[network_id]))
res = self.client.get(url)
self.assertTemplateUsed(res, 'horizon/common/_detail.html')
diff --git a/openstack_dashboard/dashboards/project/snapshots/tests.py b/openstack_dashboard/dashboards/project/snapshots/tests.py
index c2eec55de..56d723448 100644
--- a/openstack_dashboard/dashboards/project/snapshots/tests.py
+++ b/openstack_dashboard/dashboards/project/snapshots/tests.py
@@ -17,11 +17,11 @@
# under the License.
from unittest import mock
+from urllib import parse
from django.conf import settings
from django.test.utils import override_settings
from django.urls import reverse
-from django.utils.http import urlunquote
from openstack_dashboard import api
from openstack_dashboard.dashboards.project.snapshots \
@@ -49,7 +49,7 @@ class VolumeSnapshotsViewTests(test.TestCase):
self.mock_group_snapshot_list.return_value = \
self.cinder_volume_snapshots_with_groups.list()
- res = self.client.get(urlunquote(url))
+ res = self.client.get(parse.unquote(url))
self.assertEqual(res.status_code, 200)
self.assertTemplateUsed(res, 'horizon/common/_data_table_view.html')
diff --git a/openstack_dashboard/dashboards/project/volume_groups/tests.py b/openstack_dashboard/dashboards/project/volume_groups/tests.py
index d80b4fb42..4d7a8ef17 100644
--- a/openstack_dashboard/dashboards/project/volume_groups/tests.py
+++ b/openstack_dashboard/dashboards/project/volume_groups/tests.py
@@ -11,17 +11,17 @@
# under the License.
from unittest import mock
+from urllib import parse
from django.urls import reverse
-from django.utils.http import urlunquote
from openstack_dashboard.api import cinder
from openstack_dashboard.test import helpers as test
INDEX_URL = reverse('horizon:project:volume_groups:index')
-VOLUME_GROUPS_SNAP_INDEX_URL = urlunquote(reverse(
- 'horizon:project:vg_snapshots:index'))
+VOLUME_GROUPS_SNAP_INDEX_URL = parse.unquote(
+ reverse('horizon:project:vg_snapshots:index'))
class VolumeGroupTests(test.TestCase):
diff --git a/openstack_dashboard/dashboards/project/volumes/tests.py b/openstack_dashboard/dashboards/project/volumes/tests.py
index 37b39a41f..27ef73b5f 100644
--- a/openstack_dashboard/dashboards/project/volumes/tests.py
+++ b/openstack_dashboard/dashboards/project/volumes/tests.py
@@ -14,13 +14,13 @@
import copy
from unittest import mock
+from urllib import parse
from django.conf import settings
from django.forms import widgets
from django.template.defaultfilters import slugify
from django.test.utils import override_settings
from django.urls import reverse
-from django.utils.http import urlunquote
from openstack_dashboard import api
from openstack_dashboard.api import cinder
@@ -122,7 +122,7 @@ class VolumeIndexViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
self.mock_tenant_absolute_limits.return_value = \
self.cinder_limits['absolute']
- res = self.client.get(urlunquote(url))
+ res = self.client.get(parse.unquote(url))
self.assertEqual(2, self.mock_volume_backup_supported.call_count)
self.mock_volume_list_paged.assert_called_once_with(