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
This commit is contained in:
parent
d9266fd82c
commit
e4444e6979
@ -20,6 +20,7 @@ import json
|
|||||||
import logging
|
import logging
|
||||||
from operator import attrgetter
|
from operator import attrgetter
|
||||||
import sys
|
import sys
|
||||||
|
from urllib import parse
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core import exceptions as core_exceptions
|
from django.core import exceptions as core_exceptions
|
||||||
@ -32,7 +33,6 @@ from django.template.loader import render_to_string
|
|||||||
from django import urls
|
from django import urls
|
||||||
from django.utils import encoding
|
from django.utils import encoding
|
||||||
from django.utils.html import escape
|
from django.utils.html import escape
|
||||||
from django.utils import http
|
|
||||||
from django.utils.http import urlencode
|
from django.utils.http import urlencode
|
||||||
from django.utils.safestring import mark_safe
|
from django.utils.safestring import mark_safe
|
||||||
from django.utils import termcolors
|
from django.utils import termcolors
|
||||||
@ -1861,7 +1861,7 @@ class DataTable(object, metaclass=DataTableMetaclass):
|
|||||||
|
|
||||||
The return value will be used as marker/limit-based paging in the API.
|
The return value will be used as marker/limit-based paging in the API.
|
||||||
"""
|
"""
|
||||||
return http.urlquote_plus(self.get_object_id(self.data[0])) \
|
return parse.quote_plus(self.get_object_id(self.data[0])) \
|
||||||
if self.data else ''
|
if self.data else ''
|
||||||
|
|
||||||
def get_marker(self):
|
def get_marker(self):
|
||||||
@ -1869,7 +1869,7 @@ class DataTable(object, metaclass=DataTableMetaclass):
|
|||||||
|
|
||||||
The return value will be used as marker/limit-based paging in the API.
|
The return value will be used as marker/limit-based paging in the API.
|
||||||
"""
|
"""
|
||||||
return http.urlquote_plus(self.get_object_id(self.data[-1])) \
|
return parse.quote_plus(self.get_object_id(self.data[-1])) \
|
||||||
if self.data else ''
|
if self.data else ''
|
||||||
|
|
||||||
def get_prev_pagination_string(self):
|
def get_prev_pagination_string(self):
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
"""API over the nova service."""
|
"""API over the nova service."""
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
from urllib import parse
|
||||||
|
|
||||||
from django.utils import http as utils_http
|
from django.utils import http as utils_http
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
@ -91,7 +92,7 @@ class Keypairs(generic.View):
|
|||||||
request.DATA['name'],
|
request.DATA['name'],
|
||||||
request.DATA['key_type'])
|
request.DATA['key_type'])
|
||||||
return rest_utils.CreatedResponse(
|
return rest_utils.CreatedResponse(
|
||||||
'/api/nova/keypairs/%s' % utils_http.urlquote(new.name),
|
'/api/nova/keypairs/%s' % parse.quote(new.name),
|
||||||
new.to_dict()
|
new.to_dict()
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -380,7 +381,7 @@ class Servers(generic.View):
|
|||||||
|
|
||||||
new = api.nova.server_create(*args, **kw)
|
new = api.nova.server_create(*args, **kw)
|
||||||
return rest_utils.CreatedResponse(
|
return rest_utils.CreatedResponse(
|
||||||
'/api/nova/servers/%s' % utils_http.urlquote(new.id),
|
'/api/nova/servers/%s' % parse.quote(new.id),
|
||||||
new.to_dict()
|
new.to_dict()
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -445,7 +446,7 @@ class ServerGroups(generic.View):
|
|||||||
"""
|
"""
|
||||||
new_servergroup = api.nova.server_group_create(request, **request.DATA)
|
new_servergroup = api.nova.server_group_create(request, **request.DATA)
|
||||||
return rest_utils.CreatedResponse(
|
return rest_utils.CreatedResponse(
|
||||||
'/api/nova/servergroups/%s' % utils_http.urlquote(
|
'/api/nova/servergroups/%s' % parse.quote(
|
||||||
new_servergroup.id), new_servergroup.to_dict()
|
new_servergroup.id), new_servergroup.to_dict()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -14,10 +14,10 @@
|
|||||||
"""API for the swift service."""
|
"""API for the swift service."""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
from urllib import parse
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.http import StreamingHttpResponse
|
from django.http import StreamingHttpResponse
|
||||||
from django.utils.http import urlunquote
|
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
from django.views import generic
|
from django.views import generic
|
||||||
|
|
||||||
@ -148,7 +148,7 @@ class Objects(generic.View):
|
|||||||
"""
|
"""
|
||||||
path = request.GET.get('path')
|
path = request.GET.get('path')
|
||||||
if path is not None:
|
if path is not None:
|
||||||
path = urlunquote(path)
|
path = parse.unquote(path)
|
||||||
|
|
||||||
objects = api.swift.swift_get_objects(
|
objects = api.swift.swift_get_objects(
|
||||||
request,
|
request,
|
||||||
|
@ -10,11 +10,12 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
from urllib import parse
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.test.utils import override_settings
|
from django.test.utils import override_settings
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.http import urlencode
|
from django.utils.http import urlencode
|
||||||
from django.utils.http import urlunquote
|
|
||||||
|
|
||||||
from openstack_dashboard import api
|
from openstack_dashboard import api
|
||||||
from openstack_dashboard.dashboards.admin.backups \
|
from openstack_dashboard.dashboards.admin.backups \
|
||||||
@ -40,7 +41,7 @@ class AdminVolumeBackupsViewTests(test.BaseAdminViewTests):
|
|||||||
= self.cinder_volume_snapshots.list()
|
= self.cinder_volume_snapshots.list()
|
||||||
self.mock_tenant_list.return_value = [self.tenants.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.assertEqual(res.status_code, 200)
|
self.assertEqual(res.status_code, 200)
|
||||||
self.assertTemplateUsed(res, 'horizon/common/_data_table_view.html')
|
self.assertTemplateUsed(res, 'horizon/common/_data_table_view.html')
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
import collections
|
import collections
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
from urllib import parse
|
||||||
|
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
|
||||||
@ -410,8 +411,7 @@ class NetworkSubnetTests(test.BaseAdminViewTests):
|
|||||||
self.mock_subnet_list.return_value = [self.subnets.first()]
|
self.mock_subnet_list.return_value = [self.subnets.first()]
|
||||||
self.mock_tenant_quota_usages.return_value = quota_data
|
self.mock_tenant_quota_usages.return_value = quota_data
|
||||||
|
|
||||||
from django.utils.http import urlunquote
|
url = parse.unquote(reverse('horizon:admin:networks:subnets_tab',
|
||||||
url = urlunquote(reverse('horizon:admin:networks:subnets_tab',
|
|
||||||
args=[network.id]))
|
args=[network.id]))
|
||||||
res = self.client.get(url)
|
res = self.client.get(url)
|
||||||
self.assertTemplateUsed(res, 'horizon/common/_detail.html')
|
self.assertTemplateUsed(res, 'horizon/common/_detail.html')
|
||||||
|
@ -14,9 +14,9 @@
|
|||||||
|
|
||||||
import collections
|
import collections
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
from urllib import parse
|
||||||
|
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.http import urlunquote
|
|
||||||
|
|
||||||
from horizon import forms
|
from horizon import forms
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ class NetworkTests(test.BaseAdminViewTests):
|
|||||||
'mac-learning': mac_learning,
|
'mac-learning': mac_learning,
|
||||||
'dhcp_agent_scheduler': True})
|
'dhcp_agent_scheduler': True})
|
||||||
|
|
||||||
url = urlunquote(reverse('horizon:admin:networks:detail',
|
url = parse.unquote(reverse('horizon:admin:networks:detail',
|
||||||
args=[network.id]))
|
args=[network.id]))
|
||||||
|
|
||||||
res = self.client.get(url)
|
res = self.client.get(url)
|
||||||
@ -167,7 +167,7 @@ class NetworkTests(test.BaseAdminViewTests):
|
|||||||
'dhcp_agent_scheduler': True})
|
'dhcp_agent_scheduler': True})
|
||||||
self.mock_tenant_quota_usages.return_value = quota_data
|
self.mock_tenant_quota_usages.return_value = quota_data
|
||||||
|
|
||||||
url = urlunquote(reverse('horizon:admin:networks:subnets_tab',
|
url = parse.unquote(reverse('horizon:admin:networks:subnets_tab',
|
||||||
args=[network.id]))
|
args=[network.id]))
|
||||||
res = self.client.get(url)
|
res = self.client.get(url)
|
||||||
|
|
||||||
@ -211,7 +211,7 @@ class NetworkTests(test.BaseAdminViewTests):
|
|||||||
|
|
||||||
url = reverse('horizon:admin:networks:ports_tab',
|
url = reverse('horizon:admin:networks:ports_tab',
|
||||||
args=[network.id])
|
args=[network.id])
|
||||||
res = self.client.get(urlunquote(url))
|
res = self.client.get(parse.unquote(url))
|
||||||
|
|
||||||
self.assertTemplateUsed(res, 'horizon/common/_detail.html')
|
self.assertTemplateUsed(res, 'horizon/common/_detail.html')
|
||||||
ports = res.context['ports_table'].data
|
ports = res.context['ports_table'].data
|
||||||
@ -256,7 +256,7 @@ class NetworkTests(test.BaseAdminViewTests):
|
|||||||
self.mock_tenant_quota_usages.return_value = quota_data
|
self.mock_tenant_quota_usages.return_value = quota_data
|
||||||
|
|
||||||
url = reverse('horizon:admin:networks:agents_tab', args=[network.id])
|
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')
|
self.assertTemplateUsed(res, 'horizon/common/_detail.html')
|
||||||
result_agents = res.context['agents_table'].data
|
result_agents = res.context['agents_table'].data
|
||||||
@ -300,7 +300,7 @@ class NetworkTests(test.BaseAdminViewTests):
|
|||||||
{'network-ip-availability': True,
|
{'network-ip-availability': True,
|
||||||
'mac-learning': mac_learning})
|
'mac-learning': mac_learning})
|
||||||
|
|
||||||
url = urlunquote(reverse('horizon:admin:networks:subnets_tab',
|
url = parse.unquote(reverse('horizon:admin:networks:subnets_tab',
|
||||||
args=[network_id]))
|
args=[network_id]))
|
||||||
res = self.client.get(url)
|
res = self.client.get(url)
|
||||||
|
|
||||||
@ -345,7 +345,7 @@ class NetworkTests(test.BaseAdminViewTests):
|
|||||||
'network_availability_zone': True})
|
'network_availability_zone': True})
|
||||||
self.mock_tenant_quota_usages.return_value = quota_data
|
self.mock_tenant_quota_usages.return_value = quota_data
|
||||||
|
|
||||||
url = urlunquote(reverse('horizon:admin:networks:subnets_tab',
|
url = parse.unquote(reverse('horizon:admin:networks:subnets_tab',
|
||||||
args=[network.id]))
|
args=[network.id]))
|
||||||
res = self.client.get(url)
|
res = self.client.get(url)
|
||||||
|
|
||||||
@ -397,7 +397,7 @@ class NetworkTests(test.BaseAdminViewTests):
|
|||||||
'dhcp_agent_scheduler': True})
|
'dhcp_agent_scheduler': True})
|
||||||
self.mock_tenant_quota_usages.return_value = quota_data
|
self.mock_tenant_quota_usages.return_value = quota_data
|
||||||
|
|
||||||
url = urlunquote(reverse('horizon:admin:networks:subnets_tab',
|
url = parse.unquote(reverse('horizon:admin:networks:subnets_tab',
|
||||||
args=[network.id]))
|
args=[network.id]))
|
||||||
res = self.client.get(url)
|
res = self.client.get(url)
|
||||||
|
|
||||||
|
@ -11,11 +11,11 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
from urllib import parse
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.test.utils import override_settings
|
from django.test.utils import override_settings
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.http import urlunquote
|
|
||||||
|
|
||||||
from openstack_dashboard.api import cinder
|
from openstack_dashboard.api import cinder
|
||||||
from openstack_dashboard.api import keystone
|
from openstack_dashboard.api import keystone
|
||||||
@ -38,7 +38,7 @@ class VolumeSnapshotsViewTests(test.BaseAdminViewTests):
|
|||||||
self.mock_tenant_list.return_value = [self.tenants.list(), False]
|
self.mock_tenant_list.return_value = [self.tenants.list(), False]
|
||||||
|
|
||||||
url = reverse(INDEX_URL)
|
url = reverse(INDEX_URL)
|
||||||
res = self.client.get(urlunquote(url))
|
res = self.client.get(parse.unquote(url))
|
||||||
|
|
||||||
self.assertEqual(res.status_code, 200)
|
self.assertEqual(res.status_code, 200)
|
||||||
self.assertTemplateUsed(res, 'horizon/common/_data_table_view.html')
|
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_volume_list.return_value = self.cinder_volumes.list()
|
||||||
self.mock_tenant_list.return_value = [self.tenants.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.assertTemplateUsed(res, 'horizon/common/_data_table_view.html')
|
self.assertTemplateUsed(res, 'horizon/common/_data_table_view.html')
|
||||||
self.assertEqual(res.status_code, 200)
|
self.assertEqual(res.status_code, 200)
|
||||||
|
@ -13,11 +13,11 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
|
from urllib import parse
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.test.utils import override_settings
|
from django.test.utils import override_settings
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.http import urlunquote
|
|
||||||
|
|
||||||
from openstack_dashboard import api
|
from openstack_dashboard import api
|
||||||
from openstack_dashboard.dashboards.project.volumes \
|
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_server_list.return_value = [self.servers.list(), False]
|
||||||
self.mock_tenant_list.return_value = [self.tenants.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(
|
self.mock_server_list.assert_called_once_with(
|
||||||
test.IsHttpRequest(), search_opts={'all_tenants': True})
|
test.IsHttpRequest(), search_opts={'all_tenants': True})
|
||||||
|
@ -10,11 +10,12 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
from urllib import parse
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.test.utils import override_settings
|
from django.test.utils import override_settings
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.http import urlencode
|
from django.utils.http import urlencode
|
||||||
from django.utils.http import urlunquote
|
|
||||||
|
|
||||||
from openstack_dashboard import api
|
from openstack_dashboard import api
|
||||||
from openstack_dashboard.dashboards.project.backups \
|
from openstack_dashboard.dashboards.project.backups \
|
||||||
@ -39,7 +40,7 @@ class VolumeBackupsViewTests(test.TestCase):
|
|||||||
self.mock_volume_snapshot_list.return_value \
|
self.mock_volume_snapshot_list.return_value \
|
||||||
= self.cinder_volume_snapshots.list()
|
= 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.assertEqual(res.status_code, 200)
|
||||||
self.assertTemplateUsed(res, 'horizon/common/_data_table_view.html')
|
self.assertTemplateUsed(res, 'horizon/common/_data_table_view.html')
|
||||||
|
@ -14,10 +14,10 @@
|
|||||||
|
|
||||||
import collections
|
import collections
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
from urllib import parse
|
||||||
|
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.html import escape
|
from django.utils.html import escape
|
||||||
from django.utils.http import urlunquote
|
|
||||||
|
|
||||||
from horizon.workflows import views
|
from horizon.workflows import views
|
||||||
|
|
||||||
@ -200,7 +200,7 @@ class NetworkTests(test.TestCase, NetworkStubMixin):
|
|||||||
self._stub_is_extension_supported({'mac-learning': mac_learning,
|
self._stub_is_extension_supported({'mac-learning': mac_learning,
|
||||||
'network_availability_zone': True})
|
'network_availability_zone': True})
|
||||||
|
|
||||||
url = urlunquote(reverse('horizon:project:networks:detail',
|
url = parse.unquote(reverse('horizon:project:networks:detail',
|
||||||
args=[network_id]))
|
args=[network_id]))
|
||||||
|
|
||||||
res = self.client.get(url)
|
res = self.client.get(url)
|
||||||
@ -234,7 +234,7 @@ class NetworkTests(test.TestCase, NetworkStubMixin):
|
|||||||
self._stub_is_extension_supported({'mac-learning': mac_learning,
|
self._stub_is_extension_supported({'mac-learning': mac_learning,
|
||||||
'network_availability_zone': True})
|
'network_availability_zone': True})
|
||||||
|
|
||||||
url = urlunquote(reverse('horizon:project:networks:subnets_tab',
|
url = parse.unquote(reverse('horizon:project:networks:subnets_tab',
|
||||||
args=[network_id]))
|
args=[network_id]))
|
||||||
res = self.client.get(url)
|
res = self.client.get(url)
|
||||||
|
|
||||||
@ -304,7 +304,7 @@ class NetworkTests(test.TestCase, NetworkStubMixin):
|
|||||||
self._stub_is_extension_supported({'mac-learning': mac_learning,
|
self._stub_is_extension_supported({'mac-learning': mac_learning,
|
||||||
'network_availability_zone': True})
|
'network_availability_zone': True})
|
||||||
|
|
||||||
url = urlunquote(reverse('horizon:project:networks:subnets_tab',
|
url = parse.unquote(reverse('horizon:project:networks:subnets_tab',
|
||||||
args=[network_id]))
|
args=[network_id]))
|
||||||
res = self.client.get(url)
|
res = self.client.get(url)
|
||||||
|
|
||||||
@ -345,7 +345,7 @@ class NetworkTests(test.TestCase, NetworkStubMixin):
|
|||||||
self._stub_is_extension_supported({'mac-learning': mac_learning,
|
self._stub_is_extension_supported({'mac-learning': mac_learning,
|
||||||
'network_availability_zone': True})
|
'network_availability_zone': True})
|
||||||
|
|
||||||
url = urlunquote(reverse('horizon:project:networks:subnets_tab',
|
url = parse.unquote(reverse('horizon:project:networks:subnets_tab',
|
||||||
args=[network_id]))
|
args=[network_id]))
|
||||||
res = self.client.get(url)
|
res = self.client.get(url)
|
||||||
self.assertTemplateUsed(res, 'horizon/common/_detail.html')
|
self.assertTemplateUsed(res, 'horizon/common/_detail.html')
|
||||||
@ -1248,7 +1248,7 @@ class NetworkViewTests(test.TestCase, NetworkStubMixin):
|
|||||||
'network_availability_zone': True})
|
'network_availability_zone': True})
|
||||||
self.mock_tenant_quota_usages.return_value = quota_data
|
self.mock_tenant_quota_usages.return_value = quota_data
|
||||||
|
|
||||||
url = urlunquote(reverse('horizon:project:networks:subnets_tab',
|
url = parse.unquote(reverse('horizon:project:networks:subnets_tab',
|
||||||
args=[network_id]))
|
args=[network_id]))
|
||||||
|
|
||||||
res = self.client.get(url)
|
res = self.client.get(url)
|
||||||
@ -1320,7 +1320,7 @@ class NetworkViewTests(test.TestCase, NetworkStubMixin):
|
|||||||
'network_availability_zone': True})
|
'network_availability_zone': True})
|
||||||
self.mock_tenant_quota_usages.return_value = quota_data
|
self.mock_tenant_quota_usages.return_value = quota_data
|
||||||
|
|
||||||
url = urlunquote(reverse('horizon:project:networks:ports_tab',
|
url = parse.unquote(reverse('horizon:project:networks:ports_tab',
|
||||||
args=[network_id]))
|
args=[network_id]))
|
||||||
res = self.client.get(url)
|
res = self.client.get(url)
|
||||||
self.assertTemplateUsed(res, 'horizon/common/_detail.html')
|
self.assertTemplateUsed(res, 'horizon/common/_detail.html')
|
||||||
|
@ -17,11 +17,11 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
from urllib import parse
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.test.utils import override_settings
|
from django.test.utils import override_settings
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.http import urlunquote
|
|
||||||
|
|
||||||
from openstack_dashboard import api
|
from openstack_dashboard import api
|
||||||
from openstack_dashboard.dashboards.project.snapshots \
|
from openstack_dashboard.dashboards.project.snapshots \
|
||||||
@ -49,7 +49,7 @@ class VolumeSnapshotsViewTests(test.TestCase):
|
|||||||
self.mock_group_snapshot_list.return_value = \
|
self.mock_group_snapshot_list.return_value = \
|
||||||
self.cinder_volume_snapshots_with_groups.list()
|
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.assertEqual(res.status_code, 200)
|
||||||
self.assertTemplateUsed(res, 'horizon/common/_data_table_view.html')
|
self.assertTemplateUsed(res, 'horizon/common/_data_table_view.html')
|
||||||
|
|
||||||
|
@ -11,17 +11,17 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
from urllib import parse
|
||||||
|
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.http import urlunquote
|
|
||||||
|
|
||||||
from openstack_dashboard.api import cinder
|
from openstack_dashboard.api import cinder
|
||||||
from openstack_dashboard.test import helpers as test
|
from openstack_dashboard.test import helpers as test
|
||||||
|
|
||||||
|
|
||||||
INDEX_URL = reverse('horizon:project:volume_groups:index')
|
INDEX_URL = reverse('horizon:project:volume_groups:index')
|
||||||
VOLUME_GROUPS_SNAP_INDEX_URL = urlunquote(reverse(
|
VOLUME_GROUPS_SNAP_INDEX_URL = parse.unquote(
|
||||||
'horizon:project:vg_snapshots:index'))
|
reverse('horizon:project:vg_snapshots:index'))
|
||||||
|
|
||||||
|
|
||||||
class VolumeGroupTests(test.TestCase):
|
class VolumeGroupTests(test.TestCase):
|
||||||
|
@ -14,13 +14,13 @@
|
|||||||
|
|
||||||
import copy
|
import copy
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
from urllib import parse
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.forms import widgets
|
from django.forms import widgets
|
||||||
from django.template.defaultfilters import slugify
|
from django.template.defaultfilters import slugify
|
||||||
from django.test.utils import override_settings
|
from django.test.utils import override_settings
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.http import urlunquote
|
|
||||||
|
|
||||||
from openstack_dashboard import api
|
from openstack_dashboard import api
|
||||||
from openstack_dashboard.api import cinder
|
from openstack_dashboard.api import cinder
|
||||||
@ -122,7 +122,7 @@ class VolumeIndexViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
|
|||||||
self.mock_tenant_absolute_limits.return_value = \
|
self.mock_tenant_absolute_limits.return_value = \
|
||||||
self.cinder_limits['absolute']
|
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.assertEqual(2, self.mock_volume_backup_supported.call_count)
|
||||||
self.mock_volume_list_paged.assert_called_once_with(
|
self.mock_volume_list_paged.assert_called_once_with(
|
||||||
|
@ -22,6 +22,7 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import traceback
|
import traceback
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
from urllib import parse
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.messages.storage import cookie as cookie_storage
|
from django.contrib.messages.storage import cookie as cookie_storage
|
||||||
@ -31,7 +32,6 @@ from django.test.client import RequestFactory
|
|||||||
from django.test import tag
|
from django.test import tag
|
||||||
from django.test import testcases
|
from django.test import testcases
|
||||||
from django import urls
|
from django import urls
|
||||||
from django.utils import http
|
|
||||||
|
|
||||||
from openstack_auth import user
|
from openstack_auth import user
|
||||||
from openstack_auth import utils
|
from openstack_auth import utils
|
||||||
@ -289,8 +289,8 @@ class TestCase(horizon_helpers.TestCase):
|
|||||||
loc = response['location']
|
loc = response['location']
|
||||||
else:
|
else:
|
||||||
loc = ''
|
loc = ''
|
||||||
loc = http.urlunquote(loc)
|
loc = parse.unquote(loc)
|
||||||
expected_url = http.urlunquote(expected_url)
|
expected_url = parse.unquote(expected_url)
|
||||||
self.assertEqual(loc, expected_url)
|
self.assertEqual(loc, expected_url)
|
||||||
self.assertEqual(response.status_code, 302)
|
self.assertEqual(response.status_code, 302)
|
||||||
|
|
||||||
|
@ -11,9 +11,10 @@
|
|||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
from oslo_utils import timeutils
|
|
||||||
|
|
||||||
from django.utils import http as utils_http
|
from urllib import parse
|
||||||
|
|
||||||
|
from oslo_utils import timeutils
|
||||||
|
|
||||||
from openstack_dashboard.api import swift
|
from openstack_dashboard.api import swift
|
||||||
from openstack_dashboard.test.test_data import utils
|
from openstack_dashboard.test.test_data import utils
|
||||||
@ -45,8 +46,7 @@ def data(TEST):
|
|||||||
"is_public": True,
|
"is_public": True,
|
||||||
"public_url":
|
"public_url":
|
||||||
"http://public.swift.example.com:8080/" +
|
"http://public.swift.example.com:8080/" +
|
||||||
"v1/project_id/%s" % utils_http.urlquote(
|
"v1/project_id/%s" % parse.quote(container_2_name)}
|
||||||
container_2_name)}
|
|
||||||
container_2 = swift.Container(container_dict_2)
|
container_2 = swift.Container(container_dict_2)
|
||||||
container_dict_3 = {"name": "container,three%\u6346",
|
container_dict_3 = {"name": "container,three%\u6346",
|
||||||
"container_object_count": 2,
|
"container_object_count": 2,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user