summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kolodyazhny <e0ne@e0ne.info>2020-01-09 00:14:08 +0200
committerIvan Kolodyazhny <e0ne@e0ne.info>2020-01-15 12:36:11 +0200
commite976461d85f370762798316dbcc1d156ef8d4feb (patch)
treec517d9177331970de7b294df1167a73dd08e8793
parentaa3c7e1919c921289a5ae4b7f0c582ab7065c01c (diff)
downloadhorizon-e976461d85f370762798316dbcc1d156ef8d4feb.tar.gz
Remove six usage from horizon package
We don't support Python 2 anymore so we don't need this compatibility library. six.reraise usages are left as is until it'll be moved to some base lib like oslo.utils to not re-implenent this method in Horizon. This patch also removes Python2-specific base test case methods assertItemsEqual and assertNotRegexpMatches in flavor of new Python 3 analogues. Change-Id: I0b567382edf4d68674a7b8d0b02333fb57293958
-rw-r--r--horizon/base.py6
-rw-r--r--horizon/exceptions.py2
-rw-r--r--horizon/forms/fields.py5
-rw-r--r--horizon/middleware/operation_log.py10
-rw-r--r--horizon/tables/actions.py6
-rw-r--r--horizon/tables/base.py41
-rw-r--r--horizon/tables/formset.py6
-rw-r--r--horizon/tabs/base.py1
-rw-r--r--horizon/templatetags/angular.py11
-rw-r--r--horizon/test/helpers.py9
-rw-r--r--horizon/test/unit/tables/test_tables.py49
-rw-r--r--horizon/test/unit/tabs/test_tabs.py4
-rw-r--r--horizon/test/unit/test_base.py13
-rw-r--r--horizon/test/unit/test_exceptions.py2
-rw-r--r--horizon/test/unit/test_messages.py8
-rw-r--r--horizon/test/unit/utils/test_babel_extract_angular.py28
-rw-r--r--horizon/test/unit/workflows/test_workflows.py18
-rw-r--r--horizon/utils/babel_extract_angular.py14
-rw-r--r--horizon/utils/csvbase.py13
-rw-r--r--horizon/utils/functions.py7
-rw-r--r--horizon/utils/scss_filter.py4
-rw-r--r--horizon/utils/settings.py4
-rw-r--r--horizon/workflows/base.py12
-rw-r--r--horizon/workflows/views.py4
-rw-r--r--openstack_dashboard/dashboards/admin/aggregates/tests.py4
-rw-r--r--openstack_dashboard/dashboards/admin/flavors/tests.py16
-rw-r--r--openstack_dashboard/dashboards/admin/hypervisors/tests.py6
-rw-r--r--openstack_dashboard/dashboards/admin/images/tests.py2
-rw-r--r--openstack_dashboard/dashboards/admin/instances/tests.py18
-rw-r--r--openstack_dashboard/dashboards/admin/networks/subnets/tests.py2
-rw-r--r--openstack_dashboard/dashboards/admin/networks/tests.py14
-rw-r--r--openstack_dashboard/dashboards/admin/rbac_policies/tests.py2
-rw-r--r--openstack_dashboard/dashboards/admin/routers/tests.py8
-rw-r--r--openstack_dashboard/dashboards/admin/snapshots/tests.py12
-rw-r--r--openstack_dashboard/dashboards/admin/volume_types/tests.py4
-rw-r--r--openstack_dashboard/dashboards/admin/volumes/tests.py14
-rw-r--r--openstack_dashboard/dashboards/identity/domains/tests.py8
-rw-r--r--openstack_dashboard/dashboards/identity/groups/tests.py14
-rw-r--r--openstack_dashboard/dashboards/identity/identity_providers/tests.py4
-rw-r--r--openstack_dashboard/dashboards/identity/mappings/tests.py2
-rw-r--r--openstack_dashboard/dashboards/identity/projects/tests.py16
-rw-r--r--openstack_dashboard/dashboards/identity/roles/tests.py6
-rw-r--r--openstack_dashboard/dashboards/identity/users/tests.py10
-rw-r--r--openstack_dashboard/dashboards/project/backups/tests.py10
-rw-r--r--openstack_dashboard/dashboards/project/instances/tests.py12
-rw-r--r--openstack_dashboard/dashboards/project/key_pairs/tests.py2
-rw-r--r--openstack_dashboard/dashboards/project/networks/ports/tests.py2
-rw-r--r--openstack_dashboard/dashboards/project/networks/tests.py14
-rw-r--r--openstack_dashboard/dashboards/project/routers/tests.py12
-rw-r--r--openstack_dashboard/dashboards/project/security_groups/tests.py6
-rw-r--r--openstack_dashboard/dashboards/project/snapshots/tests.py12
-rw-r--r--openstack_dashboard/dashboards/project/volumes/tests.py14
-rw-r--r--openstack_dashboard/test/unit/usage/test_quotas.py16
53 files changed, 233 insertions, 306 deletions
diff --git a/horizon/base.py b/horizon/base.py
index 50efee407..43b61021d 100644
--- a/horizon/base.py
+++ b/horizon/base.py
@@ -37,7 +37,6 @@ from django.utils.functional import empty
from django.utils.functional import SimpleLazyObject
from django.utils.module_loading import module_has_submodule
from django.utils.translation import ugettext_lazy as _
-import six
from horizon import conf
from horizon.decorators import _current_component
@@ -350,7 +349,6 @@ class Panel(HorizonComponent):
return urlpatterns, self.slug, self.slug
-@six.python_2_unicode_compatible
class PanelGroup(object):
"""A container for a set of :class:`~horizon.Panel` classes.
@@ -593,7 +591,7 @@ class Dashboard(Registry, HorizonComponent):
panel_groups = []
# If we have a flat iterable of panel names, wrap it again so
# we have a consistent structure for the next step.
- if all([isinstance(i, six.string_types) for i in self.panels]):
+ if all([isinstance(i, str) for i in self.panels]):
self.panels = [self.panels]
# Now iterate our panel sets.
@@ -824,7 +822,7 @@ class Site(Registry, HorizonComponent):
if user_home:
if callable(user_home):
return user_home(user)
- elif isinstance(user_home, six.string_types):
+ elif isinstance(user_home, str):
# Assume we've got a URL if there's a slash in it
if '/' in user_home:
return user_home
diff --git a/horizon/exceptions.py b/horizon/exceptions.py
index a96c4dfc8..d3c84ca0c 100644
--- a/horizon/exceptions.py
+++ b/horizon/exceptions.py
@@ -111,7 +111,6 @@ class ServiceCatalogException(HorizonException):
super(ServiceCatalogException, self).__init__(message)
-@six.python_2_unicode_compatible
class AlreadyExists(HorizonException):
"""API resources tried to create already exists."""
def __init__(self, name, resource_type):
@@ -125,7 +124,6 @@ class AlreadyExists(HorizonException):
return self.msg % self.attrs
-@six.python_2_unicode_compatible
class GetFileError(HorizonException):
"""Exception to be raised when the value of get_file is not expected.
diff --git a/horizon/forms/fields.py b/horizon/forms/fields.py
index 8391a2ef7..9833fcb72 100644
--- a/horizon/forms/fields.py
+++ b/horizon/forms/fields.py
@@ -17,7 +17,6 @@ import itertools
import re
import netaddr
-import six
from oslo_utils import uuidutils
@@ -278,7 +277,7 @@ class SelectWidget(widgets.Widget):
def get_data_attrs(self, option_label):
other_html = []
- if not isinstance(option_label, (six.string_types, Promise)):
+ if not isinstance(option_label, (str, Promise)):
for data_attr in self.data_attrs:
data_value = html.conditional_escape(
force_text(getattr(option_label,
@@ -287,7 +286,7 @@ class SelectWidget(widgets.Widget):
return ' '.join(other_html)
def transform_option_label(self, option_label):
- if (not isinstance(option_label, (six.string_types, Promise)) and
+ if (not isinstance(option_label, (str, Promise)) and
callable(self.transform)):
option_label = self.transform(option_label)
return html.conditional_escape(force_text(option_label))
diff --git a/horizon/middleware/operation_log.py b/horizon/middleware/operation_log.py
index 6aa4455e9..af7e3d143 100644
--- a/horizon/middleware/operation_log.py
+++ b/horizon/middleware/operation_log.py
@@ -15,12 +15,12 @@
import json
import logging
import re
+from urllib import parse
from django.conf import settings
from django.contrib import messages as django_messages
from django.core.exceptions import MiddlewareNotUsed
-import six.moves.urllib.parse as urlparse
from horizon.utils import settings as setting_utils
@@ -123,7 +123,7 @@ class OperationLogMiddleware(object):
method = request.method.upper()
if not (method in self.target_methods):
return
- request_url = urlparse.unquote(request.path)
+ request_url = parse.unquote(request.path)
for rule in self._ignored_urls:
if rule.search(request_url):
return
@@ -134,8 +134,8 @@ class OperationLogMiddleware(object):
user = request.user
referer_url = None
try:
- referer_dic = urlparse.urlsplit(
- urlparse.unquote(request.META.get('HTTP_REFERER')))
+ referer_dic = parse.urlsplit(
+ parse.unquote(request.META.get('HTTP_REFERER')))
referer_url = referer_dic[2]
if referer_dic[3]:
referer_url += "?" + referer_dic[3]
@@ -143,7 +143,7 @@ class OperationLogMiddleware(object):
referer_url = referer_url.decode('utf-8')
except Exception:
pass
- request_url = urlparse.unquote(request.path)
+ request_url = parse.unquote(request.path)
if request.META['QUERY_STRING']:
request_url += '?' + request.META['QUERY_STRING']
return {
diff --git a/horizon/tables/actions.py b/horizon/tables/actions.py
index 68ca46b7b..406575d78 100644
--- a/horizon/tables/actions.py
+++ b/horizon/tables/actions.py
@@ -26,7 +26,6 @@ from django import urls
from django.utils.functional import Promise
from django.utils.http import urlencode
from django.utils.translation import ugettext_lazy as _
-import six
from horizon import exceptions
from horizon import messages
@@ -82,8 +81,7 @@ class BaseActionMetaClass(type):
return klass
-@six.add_metaclass(BaseActionMetaClass)
-class BaseAction(html.HTMLElement):
+class BaseAction(html.HTMLElement, metaclass=BaseActionMetaClass):
"""Common base class for all ``Action`` classes."""
def __init__(self, **kwargs):
@@ -719,7 +717,7 @@ class BatchAction(Action):
count = len(items)
action_attr = getattr(self, "action_%s" % action_type)(count)
- if isinstance(action_attr, (six.string_types, Promise)):
+ if isinstance(action_attr, (str, Promise)):
action = action_attr
else:
toggle_selection = getattr(self, "current_%s_action" % action_type)
diff --git a/horizon/tables/base.py b/horizon/tables/base.py
index c9ade1b54..3e9bba5b1 100644
--- a/horizon/tables/base.py
+++ b/horizon/tables/base.py
@@ -72,7 +72,6 @@ else:
getargspec = inspect.getargspec
-@six.python_2_unicode_compatible
class Column(html.HTMLElement):
"""A class which represents a single column in a :class:`.DataTable`.
@@ -332,7 +331,7 @@ class Column(html.HTMLElement):
self.transform = transform
self.name = "<%s callable>" % transform.__name__
else:
- self.transform = six.text_type(transform)
+ self.transform = str(transform)
self.name = self.transform
# Empty string is a valid value for verbose_name
@@ -342,7 +341,7 @@ class Column(html.HTMLElement):
else:
self.verbose_name = self.transform.title()
else:
- self.verbose_name = verbose_name
+ self.verbose_name = str(verbose_name)
self.auto = auto
self.sortable = sortable
@@ -386,7 +385,7 @@ class Column(html.HTMLElement):
self.classes.append('anchor')
def __str__(self):
- return six.text_type(self.verbose_name)
+ return self.verbose_name
def __repr__(self):
return '<%s: %s>' % (self.__class__.__name__, self.name)
@@ -457,7 +456,7 @@ class Column(html.HTMLElement):
"'%(data)s' on column '%(col_name)s'")
args = {'filter': filter_func.__name__,
'data': data,
- 'col_name': six.text_type(self.verbose_name)}
+ 'col_name': self.verbose_name}
LOG.warning(msg, args)
if data and self.truncate:
@@ -766,7 +765,7 @@ class Cell(html.HTMLElement):
widget = ThemableCheckboxInput(check_test=lambda value: False)
# Convert value to string to avoid accidental type conversion
data = widget.render('object_ids',
- six.text_type(table.get_object_id(datum)),
+ table.get_object_id(datum),
{'class': 'table-row-multi-select'})
table._data_cache[column][table.get_object_id(datum)] = data
elif column.auto == "form_field":
@@ -776,7 +775,7 @@ class Cell(html.HTMLElement):
widget_name = "%s__%s" % \
(column.name,
- six.text_type(table.get_object_id(datum)))
+ table.get_object_id(datum))
# Create local copy of attributes, so it don't change column
# class form_field_attributes
@@ -813,7 +812,7 @@ class Cell(html.HTMLElement):
@property
def id(self):
return ("%s__%s" % (self.column.name,
- six.text_type(self.row.table.get_object_id(self.datum))))
+ self.row.table.get_object_id(self.datum)))
@property
def value(self):
@@ -844,7 +843,7 @@ class Cell(html.HTMLElement):
data = mark_safe('<a href="%s" %s>%s</a>' % (
(escape(self.url),
link_attrs,
- escape(six.text_type(data)))))
+ escape(data))))
return data
@property
@@ -867,10 +866,10 @@ class Cell(html.HTMLElement):
if self.column.status or \
self.column.name in self.column.table._meta.status_columns:
# returns the first matching status found
- data_status_lower = six.text_type(
+ data_status_lower = str(
self.column.get_raw_data(self.datum)).lower()
for status_name, status_value in self.column.status_choices:
- if six.text_type(status_name).lower() == data_status_lower:
+ if str(status_name).lower() == data_status_lower:
self._status = status_value
return self._status
self._status = None
@@ -1149,9 +1148,9 @@ class DataTableOptions(object):
getattr(options,
'table_actions_template',
'horizon/common/_data_table_table_actions.html')
- self.context_var_name = six.text_type(getattr(options,
- 'context_var_name',
- 'table'))
+ self.context_var_name = getattr(options,
+ 'context_var_name',
+ 'table')
self.actions_column = getattr(options,
'actions_column',
len(self.row_actions) > 0)
@@ -1266,9 +1265,7 @@ class DataTableMetaclass(type):
return type.__new__(cls, name, bases, dt_attrs)
-@six.python_2_unicode_compatible
-@six.add_metaclass(DataTableMetaclass)
-class DataTable(object):
+class DataTable(object, metaclass=DataTableMetaclass):
"""A class which defines a table with all data and associated actions.
.. attribute:: name
@@ -1333,7 +1330,7 @@ class DataTable(object):
self.set_multiselect_column_visibility(bool(batch_actions))
def __str__(self):
- return six.text_type(self._meta.verbose_name)
+ return str(self._meta.verbose_name)
def __repr__(self):
return '<%s: %s>' % (self.__class__.__name__, self._meta.name)
@@ -1490,17 +1487,13 @@ class DataTable(object):
Uses :meth:`~horizon.tables.DataTable.get_object_id` internally.
"""
- if not isinstance(lookup, six.text_type):
+ if not isinstance(lookup, str):
lookup = str(lookup)
- if six.PY2:
- lookup = lookup.decode('utf-8')
matches = []
for datum in self.data:
obj_id = self.get_object_id(datum)
- if not isinstance(obj_id, six.text_type):
+ if not isinstance(obj_id, str):
obj_id = str(obj_id)
- if six.PY2:
- obj_id = obj_id.decode('utf-8')
if obj_id == lookup:
matches.append(datum)
if len(matches) > 1:
diff --git a/horizon/tables/formset.py b/horizon/tables/formset.py
index ff62c1b76..4dda69485 100644
--- a/horizon/tables/formset.py
+++ b/horizon/tables/formset.py
@@ -11,6 +11,7 @@
# under the License.
import collections
+import itertools
import logging
import sys
@@ -38,8 +39,7 @@ class FormsetCell(horizon_tables.Cell):
if self.field.errors:
self.attrs['class'] = (self.attrs.get('class', '') +
' error form-group')
- self.attrs['title'] = ' '.join(
- six.text_type(error) for error in self.field.errors)
+ self.attrs['title'] = ' '.join(self.field.errors)
class FormsetRow(horizon_tables.Row):
@@ -136,7 +136,7 @@ class FormsetDataTableMixin(object):
else:
formset = self.get_formset()
formset.is_valid()
- for datum, form in six.moves.zip_longest(self.filtered_data,
+ for datum, form in itertools.zip_longest(self.filtered_data,
formset):
row = self._meta.row_class(self, datum, form)
if self.get_object_id(datum) == self.current_item_id:
diff --git a/horizon/tabs/base.py b/horizon/tabs/base.py
index 67847bf10..12e4bf2e2 100644
--- a/horizon/tabs/base.py
+++ b/horizon/tabs/base.py
@@ -316,7 +316,6 @@ class Tab(html.HTMLElement):
# Priority: constructor, class-defined, fallback
if not self.name:
raise ValueError("%s must have a name." % self.__class__.__name__)
- self.name = six.text_type(self.name) # Force unicode.
if not self.slug:
raise ValueError("%s must have a slug." % self.__class__.__name__)
self.tab_group = tab_group
diff --git a/horizon/templatetags/angular.py b/horizon/templatetags/angular.py
index 946173d24..6055adab1 100644
--- a/horizon/templatetags/angular.py
+++ b/horizon/templatetags/angular.py
@@ -19,7 +19,6 @@ from django.core.cache import caches
from django.core.cache.utils import make_template_fragment_key
from django.dispatch import receiver
from django import template
-import six
register = template.Library()
@@ -113,14 +112,8 @@ def angular_templates(context):
result.extend(finder.find(relative_path, True))
path = result[-1]
try:
- if six.PY3:
- with open(path, encoding='utf-8') as template_file:
- angular_templates[template_static_path] = template_file.\
- read()
- else:
- with open(path) as template_file:
- angular_templates[template_static_path] = template_file.\
- read()
+ with open(path, encoding='utf-8') as template_file:
+ angular_templates[template_static_path] = template_file.read()
except (OSError, IOError):
# Failed to read template, leave the template dictionary blank
# If the caller is using this dictionary to pre-populate a cache
diff --git a/horizon/test/helpers.py b/horizon/test/helpers.py
index f42299a38..ca966f323 100644
--- a/horizon/test/helpers.py
+++ b/horizon/test/helpers.py
@@ -38,7 +38,6 @@ from django.test.client import RequestFactory
from django.test import tag
from django.test import utils as django_test_utils
from django.utils.encoding import force_text
-import six
from django.contrib.staticfiles.testing \
import StaticLiveServerTestCase as LiveServerTestCase
@@ -178,14 +177,6 @@ class TestCase(django_test.TestCase):
if hasattr(self.user, "_perm_cache"):
del self.user._perm_cache
- if six.PY3:
- # Python 2 assert methods renamed in Python 3
- def assertItemsEqual(self, expected_seq, actual_seq, msg=None):
- self.assertCountEqual(expected_seq, actual_seq, msg)
-
- def assertNotRegexpMatches(self, text, unexpected_regexp, msg=None):
- self.assertNotRegex(text, unexpected_regexp, msg)
-
def assertNoMessages(self, response=None):
"""Asserts no messages have been attached by the messages framework.
diff --git a/horizon/test/unit/tables/test_tables.py b/horizon/test/unit/tables/test_tables.py
index 0c8b53c91..1bc03501a 100644
--- a/horizon/test/unit/tables/test_tables.py
+++ b/horizon/test/unit/tables/test_tables.py
@@ -25,9 +25,7 @@ from django.template import defaultfilters
from django.test.utils import override_settings
from django.urls import reverse
from django.utils.translation import ungettext_lazy
-
import mock
-import six
from horizon import exceptions
from horizon import tables
@@ -421,7 +419,7 @@ class DataTableTests(test.TestCase):
self.assertTrue(self.table._meta.actions_column)
self.assertTrue(self.table._meta.multi_select)
# Test for verbose_name
- self.assertEqual(u"My Table", six.text_type(self.table))
+ self.assertEqual(u"My Table", str(self.table))
# Column ordering and exclusion.
# This should include auto-columns for multi_select and actions,
# but should not contain the excluded column.
@@ -603,8 +601,8 @@ class DataTableTests(test.TestCase):
self.assertEqual('1', row.cells['id'].data) # Standard attr access
self.assertEqual('custom object_1', row.cells['name'].data) # Callable
# name and verbose_name
- self.assertEqual("Id", six.text_type(id_col))
- self.assertEqual("Verbose Name", six.text_type(name_col))
+ self.assertEqual("Id", str(id_col))
+ self.assertEqual("Verbose Name", str(name_col))
# sortable
self.assertFalse(id_col.sortable)
self.assertNotIn("sortable", id_col.get_final_attrs().get('class', ""))
@@ -821,7 +819,7 @@ class DataTableTests(test.TestCase):
self.assertIsNone(handled)
self.assertQuerysetEqual(self.table.filtered_data,
['FakeObject: object_2'],
- transform=six.text_type)
+ transform=str)
# with empty filter string, it should return all data
req = self.factory.post('/my_url/', {action_string: ''})
@@ -833,7 +831,7 @@ class DataTableTests(test.TestCase):
'FakeObject: object_2',
'FakeObject: object_3',
u'FakeObject: öbject_4'],
- transform=six.text_type)
+ transform=str)
# with unknown value it should return empty list
req = self.factory.post('/my_url/', {action_string: 'horizon'})
@@ -889,15 +887,13 @@ class DataTableTests(test.TestCase):
req = self.factory.get('/my_url/')
self.table = MyTable(req, TEST_DATA_3)
toggle_action = self.table.get_row_actions(TEST_DATA_3[0])[2]
- self.assertEqual("Batch Item",
- six.text_type(toggle_action.verbose_name))
+ self.assertEqual("Batch Item", toggle_action.verbose_name)
# Batch action with custom help text
req = self.factory.get('/my_url/')
self.table = MyTable(req, TEST_DATA_3)
toggle_action = self.table.get_row_actions(TEST_DATA_3[0])[4]
- self.assertEqual("BatchHelp Item",
- six.text_type(toggle_action.verbose_name))
+ self.assertEqual("BatchHelp Item", toggle_action.verbose_name)
# Single object toggle action
# GET page - 'up' to 'down'
@@ -905,8 +901,7 @@ class DataTableTests(test.TestCase):
self.table = MyTable(req, TEST_DATA_3)
self.assertEqual(5, len(self.table.get_row_actions(TEST_DATA_3[0])))
toggle_action = self.table.get_row_actions(TEST_DATA_3[0])[3]
- self.assertEqual("Down Item",
- six.text_type(toggle_action.verbose_name))
+ self.assertEqual("Down Item", toggle_action.verbose_name)
# Toggle from status 'up' to 'down'
# POST page
@@ -927,7 +922,7 @@ class DataTableTests(test.TestCase):
self.table = MyTable(req, TEST_DATA_2)
self.assertEqual(4, len(self.table.get_row_actions(TEST_DATA_2[0])))
toggle_action = self.table.get_row_actions(TEST_DATA_2[0])[2]
- self.assertEqual("Up Item", six.text_type(toggle_action.verbose_name))
+ self.assertEqual("Up Item", toggle_action.verbose_name)
# POST page
action_string = "my_table__toggle__2"
@@ -1008,7 +1003,7 @@ class DataTableTests(test.TestCase):
self.assertIsNone(handled)
self.assertQuerysetEqual(self.table.filtered_data,
['FakeObject: object_2'],
- transform=six.text_type)
+ transform=str)
# Ensure filtering respects the request method, e.g. no filter here
req = self.factory.get('/my_url/', {action_string: '2'})
@@ -1020,7 +1015,7 @@ class DataTableTests(test.TestCase):
'FakeObject: object_2',
'FakeObject: object_3',
u'FakeObject: öbject_4'],
- transform=six.text_type)
+ transform=str)
# Updating and preemptive actions
params = {"table": "my_table", "action": "row_update", "obj_id": "1"}
@@ -1046,16 +1041,12 @@ class DataTableTests(test.TestCase):
# Verbose names
table_actions = self.table.get_table_actions()
- self.assertEqual("Filter",
- six.text_type(table_actions[0].verbose_name))
- self.assertEqual("Delete Me",
- six.text_type(table_actions[1].verbose_name))
+ self.assertEqual("Filter", table_actions[0].verbose_name)
+ self.assertEqual("Delete Me", table_actions[1].verbose_name)
row_actions = self.table.get_row_actions(TEST_DATA[0])
- self.assertEqual("Delete Me",
- six.text_type(row_actions[0].verbose_name))
- self.assertEqual("Log In",
- six.text_type(row_actions[1].verbose_name))
+ self.assertEqual("Delete Me", row_actions[0].verbose_name)
+ self.assertEqual("Log In", row_actions[1].verbose_name)
def test_server_filtering(self):
filter_value_param = "my_table__filter__q"
@@ -1070,7 +1061,7 @@ class DataTableTests(test.TestCase):
self.assertIsNone(handled)
self.assertQuerysetEqual(self.table.filtered_data,
['FakeObject: object_2'],
- transform=six.text_type)
+ transform=str)
# Ensure API filtering does not filter on server, e.g. no filter here
req = self.factory.post('/my_url/')
@@ -1084,7 +1075,7 @@ class DataTableTests(test.TestCase):
'FakeObject: object_2',
'FakeObject: object_3',
u'FakeObject: öbject_4'],
- transform=six.text_type)
+ transform=str)
def test_column_uniqueness(self):
table1 = MyTable(self.request)
@@ -1195,8 +1186,8 @@ class DataTableTests(test.TestCase):
self.assertEqual('1', row.cells['id'].data) # Standard attr access
self.assertEqual('custom object_1', row.cells['name'].data) # Callable
# name and verbose_name
- self.assertEqual("Id", six.text_type(id_col))
- self.assertEqual("Verbose Name", six.text_type(name_col))
+ self.assertEqual("Id", str(id_col))
+ self.assertEqual("Verbose Name", str(name_col))
self.assertIn("sortable", name_col.get_final_attrs().get('class', ""))
# hidden
self.assertTrue(id_col.hidden)
@@ -1378,7 +1369,7 @@ class DataTableViewTests(test.TestCase):
'FakeObject: object_2',
'FakeObject: object_3',
u'FakeObject: öbject_4'],
- transform=six.text_type)
+ transform=str)
self.assertEqual(req.session.get(self.fil_value_param), 'up')
self.assertEqual(req.session.get(self.fil_field_param), 'status')
diff --git a/horizon/test/unit/tabs/test_tabs.py b/horizon/test/unit/tabs/test_tabs.py
index 6c50e401b..2f009e8c2 100644
--- a/horizon/test/unit/tabs/test_tabs.py
+++ b/horizon/test/unit/tabs/test_tabs.py
@@ -20,8 +20,6 @@ from django.conf import settings
from django import http
from django.test.utils import override_settings
-import six
-
from horizon import exceptions
from horizon import middleware
from horizon import tabs as horizon_tabs
@@ -299,7 +297,7 @@ class TabTests(test.TestCase):
'FakeObject: object_2',
'FakeObject: object_3',
u'FakeObject: öbject_4'],
- transform=six.text_type)
+ transform=str)
context = tab.get_context_data(self.request)
# Make sure our table is loaded into the context correctly
self.assertEqual(table, context['my_table_table'])
diff --git a/horizon/test/unit/test_base.py b/horizon/test/unit/test_base.py
index 5b0bffd87..3d9bea4e0 100644
--- a/horizon/test/unit/test_base.py
+++ b/horizon/test/unit/test_base.py
@@ -17,10 +17,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-from importlib import import_module
-
-import six
-from six import moves
+import importlib
from django.conf import settings
from django.contrib.auth.models import User
@@ -106,7 +103,7 @@ class BaseHorizonTests(test.TestCase):
del base.Horizon
base.Horizon = base.HorizonSite()
# Reload the convenience references to Horizon stored in __init__
- moves.reload_module(import_module("horizon"))
+ importlib.reload(importlib.import_module("horizon"))
# Re-register our original dashboards and panels.
# This is necessary because autodiscovery only works on the first
# import, and calling reload introduces innumerable additional
@@ -126,7 +123,7 @@ class BaseHorizonTests(test.TestCase):
Useful only for testing and should never be used on a live site.
"""
urls.clear_url_caches()
- moves.reload_module(import_module(settings.ROOT_URLCONF))
+ importlib.reload(importlib.import_module(settings.ROOT_URLCONF))
base.Horizon._urls()
@@ -168,7 +165,7 @@ class HorizonTests(BaseHorizonTests):
horizon.get_dashboard(MyDash)
def test_site(self):
- self.assertEqual("Horizon", six.text_type(base.Horizon))
+ self.assertEqual("Horizon", str(base.Horizon))
self.assertEqual("<Site: horizon>", repr(base.Horizon))
dash = base.Horizon.get_dashboard('cats')
self.assertEqual(dash, base.Horizon.get_default_dashboard())
@@ -499,7 +496,7 @@ class RbacHorizonTests(test.TestCase):
del base.Horizon
base.Horizon = base.HorizonSite()
# Reload the convenience references to Horizon stored in __init__
- moves.reload_module(import_module("horizon"))
+ importlib.reload(importlib.import_module("horizon"))
# Reset Cats and Dogs default_panel to default values
Cats.default_panel = 'kittens'
diff --git a/horizon/test/unit/test_exceptions.py b/horizon/test/unit/test_exceptions.py
index ed6458ed5..f676f6bfa 100644
--- a/horizon/test/unit/test_exceptions.py
+++ b/horizon/test/unit/test_exceptions.py
@@ -37,7 +37,7 @@ class HandleTests(test.TestCase):
# The real test here is to make sure the handle method doesn't throw a
# UnicodeEncodeError, but making sure the message is correct and
# useful as well.
- self.assertItemsEqual(req.horizon['async_messages'], [expected])
+ self.assertCountEqual(req.horizon['async_messages'], [expected])
def test_handle_message_as_recoverable(self):
# tests that if a message is passed to handle that it is treated
diff --git a/horizon/test/unit/test_messages.py b/horizon/test/unit/test_messages.py
index 1a3d370dd..92e95b53f 100644
--- a/horizon/test/unit/test_messages.py
+++ b/horizon/test/unit/test_messages.py
@@ -29,10 +29,10 @@ class MessageTests(test.TestCase):
string = "Giant ants are attacking San Francisco!"
expected = ["error", force_text(string), ""]
self.assertIn("async_messages", req.horizon)
- self.assertItemsEqual(req.horizon['async_messages'], [])
+ self.assertCountEqual(req.horizon['async_messages'], [])
req.META['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest'
messages.error(req, string)
- self.assertItemsEqual(req.horizon['async_messages'], [expected])
+ self.assertCountEqual(req.horizon['async_messages'], [expected])
res = http.HttpResponse()
res = middleware.HorizonMiddleware('dummy_get_response') \
._process_response(req, res)
@@ -44,10 +44,10 @@ class MessageTests(test.TestCase):
string = mark_safe("We are now safe from ants! Go <a>here</a>!")
expected = ["error", force_text(string), " safe"]
self.assertIn("async_messages", req.horizon)
- self.assertItemsEqual(req.horizon['async_messages'], [])
+ self.assertCountEqual(req.horizon['async_messages'], [])
req.META['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest'
messages.error(req, string)
- self.assertItemsEqual(req.horizon['async_messages'], [expected])
+ self.assertCountEqual(req.horizon['async_messages'], [expected])
res = http.HttpResponse()
res = middleware.HorizonMiddleware('dummy_get_response') \
._process_response(req, res)
diff --git a/horizon/test/unit/utils/test_babel_extract_angular.py b/horizon/test/unit/utils/test_babel_extract_angular.py
index 7aacf8ad2..ea3659f24 100644
--- a/horizon/test/unit/utils/test_babel_extract_angular.py
+++ b/horizon/test/unit/utils/test_babel_extract_angular.py
@@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-from six import StringIO
+import io
from horizon.test import helpers as test
from horizon.utils.babel_extract_angular import extract_angular
@@ -24,13 +24,13 @@ default_keys = []
class ExtractAngularTestCase(test.TestCase):
def test_extract_no_tags(self):
- buf = StringIO('<html></html>')
+ buf = io.StringIO('<html></html>')
messages = list(extract_angular(buf, default_keys, [], {}))
self.assertEqual([], messages)
def test_simple_string(self):
- buf = StringIO(
+ buf = io.StringIO(
"""<html><translate>hello world!</translate>'
<div translate>hello world!</div></html>"""
)
@@ -45,27 +45,27 @@ class ExtractAngularTestCase(test.TestCase):
def test_attr_value(self):
"""Should not translate tags with translate as the value of an attr."""
- buf = StringIO('<html><div id="translate">hello world!</div></html>')
+ buf = io.StringIO('<html><div id="translate">hello world!</div></html>')
messages = list(extract_angular(buf, [], [], {}))
self.assertEqual([], messages)
def test_attr_value_plus_directive(self):
"""Unless they also have a translate directive."""
- buf = StringIO(
+ buf = io.StringIO(
'<html><div id="translate" translate>hello world!</div></html>')
messages = list(extract_angular(buf, [], [], {}))
self.assertEqual([(1, 'gettext', 'hello world!', [])], messages)
def test_translate_tag(self):
- buf = StringIO('<html><translate>hello world!</translate></html>')
+ buf = io.StringIO('<html><translate>hello world!</translate></html>')
messages = list(extract_angular(buf, [], [], {}))
self.assertEqual([(1, 'gettext', 'hello world!', [])], messages)
def test_plural_form(self):
- buf = StringIO(
+ buf = io.StringIO(
(
'<html><translate translate-plural="hello {$count$} worlds!">'
'hello one world!</translate></html>'
@@ -82,7 +82,7 @@ class ExtractAngularTestCase(test.TestCase):
], messages)
def test_translate_tag_comments(self):
- buf = StringIO(
+ buf = io.StringIO(
'<html><translate translate-comment='
'"What a beautiful world">hello world!</translate></html>')
@@ -94,7 +94,7 @@ class ExtractAngularTestCase(test.TestCase):
messages)
def test_comments(self):
- buf = StringIO(
+ buf = io.StringIO(
'<html><div translate translate-comment='
'"What a beautiful world">hello world!</div></html>')
@@ -106,7 +106,7 @@ class ExtractAngularTestCase(test.TestCase):
messages)
def test_multiple_comments(self):
- buf = StringIO(
+ buf = io.StringIO(
'<html><translate '
'translate-comment="What a beautiful world"'
'translate-comment="Another comment"'
@@ -125,7 +125,7 @@ class ExtractAngularTestCase(test.TestCase):
def test_filter(self):
# test also for some forms that should not match
- buf = StringIO(
+ buf = io.StringIO(
"""
<img alt="{$ 'hello world1' | translate $}">
<p>{$'hello world2'|translate$}</p>
@@ -167,7 +167,7 @@ class ExtractAngularTestCase(test.TestCase):
messages)
def test_trim_translate_tag(self):
- buf = StringIO(
+ buf = io.StringIO(
"<html><translate> \n hello\n world! \n "
"</translate></html>")
@@ -175,7 +175,7 @@ class ExtractAngularTestCase(test.TestCase):
self.assertEqual([(1, 'gettext', 'hello\n world!', [])], messages)
def test_nested_translate_tag(self):
- buf = StringIO(
+ buf = io.StringIO(
"<html><translate>hello <b>beautiful <i>world</i></b> !"
"</translate></html>"
)
@@ -186,7 +186,7 @@ class ExtractAngularTestCase(test.TestCase):
messages)
def test_nested_variations(self):
- buf = StringIO(
+ buf = io.StringIO(
'''
<p translate>To <a href="link">link</a> here</p>
<p translate>To <!-- a comment!! --> here</p>
diff --git a/horizon/test/unit/workflows/test_workflows.py b/horizon/test/unit/workflows/test_workflows.py
index 04b907b57..7df55c208 100644
--- a/horizon/test/unit/workflows/test_workflows.py
+++ b/horizon/test/unit/workflows/test_workflows.py
@@ -12,11 +12,10 @@
# License for the specific language governing permissions and limitations
# under the License.
-from django import forms
-from django import http
import mock
-import six
+from django import forms
+from django import http
from horizon import base
from horizon import exceptions
@@ -345,10 +344,10 @@ class WorkflowsTests(test.TestCase):
req = self.factory.get("/foo")
flow = TestWorkflow(req)
output = http.HttpResponse(flow.render())
- self.assertContains(output, six.text_type(flow.name))
- self.assertContains(output, six.text_type(TestActionOne.name))
- self.assertContains(output, six.text_type(TestActionTwo.name))
- self.assertContains(output, six.text_type(TestActionThree.name))
+ self.assertContains(output, flow.name)
+ self.assertContains(output, TestActionOne.name)
+ self.assertContains(output, TestActionTwo.name)
+ self.assertContains(output, TestActionThree.name)
def test_has_permissions(self):
self.assertQuerysetEqual(TestWorkflow._cls_registry, [])
@@ -356,7 +355,7 @@ class WorkflowsTests(test.TestCase):
flow = TestWorkflow(self.request)
step = AdminStep(flow)
- self.assertItemsEqual(step.permissions,
+ self.assertCountEqual(step.permissions,
("horizon.test",))
self.assertQuerysetEqual(flow.steps,
['<TestStepOne: test_action_one>',
@@ -391,8 +390,7 @@ class WorkflowsTests(test.TestCase):
TestWorkflow.register(AdminForbiddenStep)
flow = TestWorkflow(self.request)
output = http.HttpResponse(flow.render())
- self.assertNotContains(output,
- six.text_type(AdminForbiddenAction.name))
+ self.assertNotContains(output, AdminForbiddenAction.name)
def test_entry_point(self):
req = self.factory.get("/foo")
diff --git a/horizon/utils/babel_extract_angular.py b/horizon/utils/babel_extract_angular.py
index 4d06c271e..1179287c2 100644
--- a/horizon/utils/babel_extract_angular.py
+++ b/horizon/utils/babel_extract_angular.py
@@ -13,10 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+from html import parser
import re
from oslo_utils import encodeutils
-from six.moves import html_parser
# regex to find filter translation expressions
@@ -35,7 +35,7 @@ HTML_ENTITY_DECODED = {
}
-class AngularGettextHTMLParser(html_parser.HTMLParser):
+class AngularGettextHTMLParser(parser.HTMLParser):
"""Parse HTML to find translate directives.
Currently this parses for these forms of translation:
@@ -54,13 +54,9 @@ class AngularGettextHTMLParser(html_parser.HTMLParser):
"""
def __init__(self):
- try:
- super(AngularGettextHTMLParser, self).__init__(
- convert_charrefs=False
- )
- except TypeError:
- # handle HTMLParser not being a type on Python 2
- html_parser.HTMLParser.__init__(self)
+ super(AngularGettextHTMLParser, self).__init__(
+ convert_charrefs=False
+ )
self.in_translate = False
self.inner_tags = []
diff --git a/horizon/utils/csvbase.py b/horizon/utils/csvbase.py
index 514459789..4cc095321 100644
--- a/horizon/utils/csvbase.py
+++ b/horizon/utils/csvbase.py
@@ -13,13 +13,11 @@
from __future__ import division
import csv
+import io
from django.http import HttpResponse
from django.http import StreamingHttpResponse
from django import template as django_template
-import six
-
-from six import StringIO
class CsvDataMixin(object):
@@ -32,7 +30,7 @@ class CsvDataMixin(object):
will be shown in the result file. Optional.
"""
def __init__(self):
- self.out = StringIO()
+ self.out = io.StringIO()
super(CsvDataMixin, self).__init__()
if hasattr(self, "columns"):
columns = [self.encode(col) for col in self.columns]
@@ -61,12 +59,7 @@ class CsvDataMixin(object):
self.writer.writerow([self.encode(col) for col in args])
def encode(self, value):
- value = six.text_type(value)
- if six.PY2:
- # csv and StringIO cannot work with mixed encodings,
- # so encode all with utf-8
- value = value.encode('utf-8')
- return value
+ return str(value)
class BaseCsvResponse(CsvDataMixin, HttpResponse):
diff --git a/horizon/utils/functions.py b/horizon/utils/functions.py
index 10799d0e5..1052c8ff8 100644
--- a/horizon/utils/functions.py
+++ b/horizon/utils/functions.py
@@ -16,7 +16,6 @@ import math
import re
from oslo_utils import units
-import six
from django.conf import settings
from django.contrib.auth import logout
@@ -31,7 +30,7 @@ def _lazy_join(separator, strings):
for s in strings])
-lazy_join = lazy(_lazy_join, six.text_type)
+lazy_join = lazy(_lazy_join, str)
def bytes_to_gigabytes(bytes):
@@ -44,9 +43,7 @@ def add_logout_reason(request, response, reason, status='success'):
# Store the translated string in the cookie
lang = translation.get_language_from_request(request)
with translation.override(lang):
- reason = six.text_type(reason)
- if six.PY2:
- reason = reason.encode('utf-8')
+ reason = str(reason)
response.set_cookie('logout_reason', reason, max_age=10)
response.set_cookie('logout_status', status, max_age=10)
diff --git a/horizon/utils/scss_filter.py b/horizon/utils/scss_filter.py
index 3ae2ac514..27eb46017 100644
--- a/horizon/utils/scss_filter.py
+++ b/horizon/utils/scss_filter.py
@@ -20,8 +20,6 @@ from django_pyscss import DjangoScssCompiler
from scss.namespace import Namespace
from scss.types import String
-import six
-
class HorizonScssFilter(DjangoScssFilter):
def __init__(self, *args, **kwargs):
@@ -32,7 +30,7 @@ class HorizonScssFilter(DjangoScssFilter):
# Add variables to the SCSS Global Namespace Here
self.namespace.set_variable(
'$static_url',
- String(six.text_type(settings.STATIC_URL))
+ String(settings.STATIC_URL)
)
# Create a compiler with the right namespace
diff --git a/horizon/utils/settings.py b/horizon/utils/settings.py
index 6adffead1..eb77f748f 100644
--- a/horizon/utils/settings.py
+++ b/horizon/utils/settings.py
@@ -10,8 +10,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import six
-
from django.conf import settings
from django.utils.module_loading import import_string
@@ -19,7 +17,7 @@ from horizon import defaults
def import_object(name_or_object):
- if isinstance(name_or_object, six.string_types):
+ if isinstance(name_or_object, str):
return import_string(name_or_object)
return name_or_object
diff --git a/horizon/workflows/base.py b/horizon/workflows/base.py
index 7a6ccace3..3980e6003 100644
--- a/horizon/workflows/base.py
+++ b/horizon/workflows/base.py
@@ -30,7 +30,6 @@ from django.utils.encoding import force_text
from django.utils import module_loading
from django.utils.translation import ugettext_lazy as _
from openstack_auth import policy
-import six
from horizon import base
from horizon import exceptions
@@ -78,9 +77,7 @@ class ActionMetaclass(forms.forms.DeclarativeFieldsMetaclass):
return cls_
-@six.python_2_unicode_compatible
-@six.add_metaclass(ActionMetaclass)
-class Action(forms.Form):
+class Action(forms.Form, metaclass=ActionMetaclass):
"""An ``Action`` represents an atomic logical interaction with the system.
This is easier to understand with a conceptual example: in the context of
@@ -216,7 +213,6 @@ class MembershipAction(Action):
return self.slug + "_role_" + role_id
-@six.python_2_unicode_compatible
class Step(object):
"""A wrapper around an action which defines its context in a workflow.
@@ -348,7 +344,7 @@ class Step(object):
# If it's callable we know the function exists and is valid
self._handlers[key].append(possible_handler)
continue
- elif not isinstance(possible_handler, six.string_types):
+ elif not isinstance(possible_handler, str):
raise TypeError("Connection handlers must be either "
"callables or strings.")
bits = possible_handler.split(".")
@@ -525,9 +521,7 @@ class UpdateMembersStep(Step):
return self.slug + "_role_" + role_id
-@six.python_2_unicode_compatible
-@six.add_metaclass(WorkflowMetaclass)
-class Workflow(html.HTMLElement):
+class Workflow(html.HTMLElement, metaclass=WorkflowMetaclass):
"""A Workflow is a collection of Steps.
Its interface is very straightforward, but it is responsible for handling
diff --git a/horizon/workflows/views.py b/horizon/workflows/views.py
index 89ed1c044..9c8fe1a27 100644
--- a/horizon/workflows/views.py
+++ b/horizon/workflows/views.py
@@ -20,8 +20,6 @@ from django import http
from django import shortcuts
from django.views import generic
-import six
-
from horizon import exceptions
from horizon.forms import views as hz_views
from horizon.forms.views import ADD_TO_FIELD_HEADER
@@ -159,7 +157,7 @@ class WorkflowView(hz_views.ModalBackdropMixin, generic.TemplateView):
for step in workflow.steps[start:end + 1]:
if not step.action.is_valid():
errors[step.slug] = dict(
- (field, [six.text_type(error) for error in errors])
+ (field, [str(error) for error in errors])
for (field, errors) in step.action.errors.items())
return {
'has_errors': bool(errors),
diff --git a/openstack_dashboard/dashboards/admin/aggregates/tests.py b/openstack_dashboard/dashboards/admin/aggregates/tests.py
index c93f3d2c2..96881f7a9 100644
--- a/openstack_dashboard/dashboards/admin/aggregates/tests.py
+++ b/openstack_dashboard/dashboards/admin/aggregates/tests.py
@@ -220,9 +220,9 @@ class AggregatesViewTests(test.BaseAdminViewTests):
res = self.client.get(reverse(constants.AGGREGATES_INDEX_URL))
self.assertTemplateUsed(res, constants.AGGREGATES_INDEX_VIEW_TEMPLATE)
- self.assertItemsEqual(res.context['host_aggregates_table'].data,
+ self.assertCountEqual(res.context['host_aggregates_table'].data,
self.aggregates.list())
- self.assertItemsEqual(res.context['availability_zones_table'].data,
+ self.assertCountEqual(res.context['availability_zones_table'].data,
self.availability_zones.list())
self.mock_aggregate_details_list.assert_called_once_with(
test.IsHttpRequest())
diff --git a/openstack_dashboard/dashboards/admin/flavors/tests.py b/openstack_dashboard/dashboards/admin/flavors/tests.py
index a5ae96d6e..47e7bbbe0 100644
--- a/openstack_dashboard/dashboards/admin/flavors/tests.py
+++ b/openstack_dashboard/dashboards/admin/flavors/tests.py
@@ -34,7 +34,7 @@ class FlavorsViewTests(test.BaseAdminViewTests):
res = self.client.get(reverse(constants.FLAVORS_INDEX_URL))
self.assertTemplateUsed(res, constants.FLAVORS_TEMPLATE_NAME)
- self.assertItemsEqual(res.context['table'].data, self.flavors.list())
+ self.assertCountEqual(res.context['table'].data, self.flavors.list())
self.mock_flavor_list_paged.assert_called_once_with(
test.IsHttpRequest(), None, marker=None, paginate=True,
@@ -57,13 +57,13 @@ class FlavorsViewTests(test.BaseAdminViewTests):
# get all
res = self.client.get(reverse(constants.FLAVORS_INDEX_URL))
self.assertTemplateUsed(res, constants.FLAVORS_TEMPLATE_NAME)
- self.assertItemsEqual(res.context['table'].data,
+ self.assertCountEqual(res.context['table'].data,
self.flavors.list()[:5])
# get first page with 2 items
res = self.client.get(reverse(constants.FLAVORS_INDEX_URL))
self.assertTemplateUsed(res, constants.FLAVORS_TEMPLATE_NAME)
- self.assertItemsEqual(res.context['table'].data,
+ self.assertCountEqual(res.context['table'].data,
self.flavors.list()[:2])
# get second page (items 2-4)
@@ -71,7 +71,7 @@ class FlavorsViewTests(test.BaseAdminViewTests):
flavors_list[2].id])
url = "?".join([reverse(constants.FLAVORS_INDEX_URL), params])
res = self.client.get(url)
- self.assertItemsEqual(res.context['table'].data,
+ self.assertCountEqual(res.context['table'].data,
self.flavors.list()[2:4])
self.mock_flavor_list_paged.assert_has_calls([
@@ -108,13 +108,13 @@ class FlavorsViewTests(test.BaseAdminViewTests):
# get all
res = self.client.get(reverse(constants.FLAVORS_INDEX_URL))
self.assertTemplateUsed(res, constants.FLAVORS_TEMPLATE_NAME)
- self.assertItemsEqual(res.context['table'].data,
+ self.assertCountEqual(res.context['table'].data,
self.flavors.list()[:3])
# get first page with 2 items
res = self.client.get(reverse(constants.FLAVORS_INDEX_URL))
self.assertEqual(len(res.context['table'].data),
settings.API_RESULT_PAGE_SIZE)
- self.assertItemsEqual(res.context['table'].data,
+ self.assertCountEqual(res.context['table'].data,
self.flavors.list()[:2])
params = "=".join([tables.FlavorsTable._meta.pagination_param,
flavors_list[2].id])
@@ -122,7 +122,7 @@ class FlavorsViewTests(test.BaseAdminViewTests):
res = self.client.get(url)
# get second page (item 3)
self.assertEqual(len(res.context['table'].data), 1)
- self.assertItemsEqual(res.context['table'].data,
+ self.assertCountEqual(res.context['table'].data,
self.flavors.list()[2:3])
params = "=".join([tables.FlavorsTable._meta.prev_pagination_param,
@@ -132,7 +132,7 @@ class FlavorsViewTests(test.BaseAdminViewTests):
# prev back to get first page with 2 items
self.assertEqual(len(res.context['table'].data),
settings.API_RESULT_PAGE_SIZE)
- self.assertItemsEqual(res.context['table'].data,
+ self.assertCountEqual(res.context['table'].data,
self.flavors.list()[:2])
self.mock_flavor_list_paged.assert_has_calls([
diff --git a/openstack_dashboard/dashboards/admin/hypervisors/tests.py b/openstack_dashboard/dashboards/admin/hypervisors/tests.py
index 886e06530..5d21a9042 100644
--- a/openstack_dashboard/dashboards/admin/hypervisors/tests.py
+++ b/openstack_dashboard/dashboards/admin/hypervisors/tests.py
@@ -38,12 +38,12 @@ class HypervisorViewTest(test.BaseAdminViewTests):
self.assertTemplateUsed(res, 'admin/hypervisors/index.html')
hypervisors_tab = res.context['tab_group'].get_tab('hypervisor')
- self.assertItemsEqual(hypervisors_tab._tables['hypervisors'].data,
+ self.assertCountEqual(hypervisors_tab._tables['hypervisors'].data,
hypervisors)
host_tab = res.context['tab_group'].get_tab('compute_host')
host_table = host_tab._tables['compute_host']
- self.assertItemsEqual(host_table.data, compute_services)
+ self.assertCountEqual(host_table.data, compute_services)
actions_host_up = host_table.get_row_actions(host_table.data[0])
self.assertEqual(1, len(actions_host_up))
actions_host_down = host_table.get_row_actions(host_table.data[1])
@@ -105,7 +105,7 @@ class HypervisorDetailViewTest(test.BaseAdminViewTests):
hypervisor.hypervisor_hostname)])
res = self.client.get(url)
self.assertTemplateUsed(res, 'admin/hypervisors/detail.html')
- self.assertItemsEqual(res.context['table'].data, hypervisor.servers)
+ self.assertCountEqual(res.context['table'].data, hypervisor.servers)
self.mock_hypervisor_search.assert_called_once_with(
test.IsHttpRequest(), hypervisor.hypervisor_hostname)
diff --git a/openstack_dashboard/dashboards/admin/images/tests.py b/openstack_dashboard/dashboards/admin/images/tests.py
index 97fb796d5..a75ba4d72 100644
--- a/openstack_dashboard/dashboards/admin/images/tests.py
+++ b/openstack_dashboard/dashboards/admin/images/tests.py
@@ -78,7 +78,7 @@ class ImagesViewTest(test.BaseAdminViewTests):
res = self.client.get(reverse('horizon:admin:images:index'))
self.assertTemplateUsed(res, INDEX_TEMPLATE)
images = res.context['table'].data
- self.assertItemsEqual(images, [])
+ self.assertCountEqual(images, [])
@override_settings(API_RESULT_PAGE_SIZE=2)
@mock.patch.object(api.glance, 'image_list_detailed')
diff --git a/openstack_dashboard/dashboards/admin/instances/tests.py b/openstack_dashboard/dashboards/admin/instances/tests.py
index 105e698ee..fc4d03537 100644
--- a/openstack_dashboard/dashboards/admin/instances/tests.py
+++ b/openstack_dashboard/dashboards/admin/instances/tests.py
@@ -50,7 +50,7 @@ class InstanceViewTest(test.BaseAdminViewTests):
res = self.client.get(INDEX_URL)
self.assertTemplateUsed(res, INDEX_TEMPLATE)
instances = res.context['table'].data
- self.assertItemsEqual(instances, servers)
+ self.assertCountEqual(instances, servers)
self.mock_extension_supported.assert_has_calls([
mock.call('AdminActions', test.IsHttpRequest()),
@@ -94,7 +94,7 @@ class InstanceViewTest(test.BaseAdminViewTests):
self.assertTemplateUsed(res, INDEX_TEMPLATE)
instances = res.context['table'].data
- self.assertItemsEqual(instances, servers)
+ self.assertCountEqual(instances, servers)
search_opts = {'marker': None, 'paginate': True, 'all_tenants': True}
self.mock_server_list_paged.assert_called_once_with(
@@ -143,7 +143,7 @@ class InstanceViewTest(test.BaseAdminViewTests):
# there will be only one error message for all instances
# (messages de-duplication).
self.assertMessageCount(res, error=1)
- self.assertItemsEqual(instances, servers)
+ self.assertCountEqual(instances, servers)
self.mock_image_list_detailed_by_ids.assert_called_once_with(
test.IsHttpRequest(), instances_img_ids)
@@ -487,7 +487,7 @@ class InstanceViewTest(test.BaseAdminViewTests):
res = self.client.get(INDEX_URL)
self.assertTemplateUsed(res, INDEX_TEMPLATE)
instances = res.context['table'].data
- self.assertItemsEqual(instances, [])
+ self.assertCountEqual(instances, [])
@test.create_mocks({
api.nova: ['flavor_list',
@@ -559,7 +559,7 @@ class InstanceViewTest(test.BaseAdminViewTests):
has_more=True,
has_prev=False)
servers = res.context['table'].data
- self.assertItemsEqual(servers, expected_servers)
+ self.assertCountEqual(servers, expected_servers)
# get second page
expected_servers = mox_servers[size:2 * size]
@@ -570,7 +570,7 @@ class InstanceViewTest(test.BaseAdminViewTests):
has_more=True,
has_prev=True)
servers = res.context['table'].data
- self.assertItemsEqual(servers, expected_servers)
+ self.assertCountEqual(servers, expected_servers)
# get last page
expected_servers = mox_servers[-size:]
@@ -581,7 +581,7 @@ class InstanceViewTest(test.BaseAdminViewTests):
has_more=False,
has_prev=True)
servers = res.context['table'].data
- self.assertItemsEqual(servers, expected_servers)
+ self.assertCountEqual(servers, expected_servers)
@override_settings(API_RESULT_PAGE_SIZE=1)
def test_servers_index_paginated_prev(self):
@@ -598,7 +598,7 @@ class InstanceViewTest(test.BaseAdminViewTests):
has_more=False,
has_prev=True)
servers = res.context['table'].data
- self.assertItemsEqual(servers, expected_servers)
+ self.assertCountEqual(servers, expected_servers)
# back to first page
expected_servers = mox_servers[:size]
@@ -609,4 +609,4 @@ class InstanceViewTest(test.BaseAdminViewTests):
has_more=True,
has_prev=False)
servers = res.context['table'].data
- self.assertItemsEqual(servers, expected_servers)
+ self.assertCountEqual(servers, expected_servers)
diff --git a/openstack_dashboard/dashboards/admin/networks/subnets/tests.py b/openstack_dashboard/dashboards/admin/networks/subnets/tests.py
index 8b889f722..b95d42feb 100644
--- a/openstack_dashboard/dashboards/admin/networks/subnets/tests.py
+++ b/openstack_dashboard/dashboards/admin/networks/subnets/tests.py
@@ -416,7 +416,7 @@ class NetworkSubnetTests(test.BaseAdminViewTests):
res = self.client.get(url)
self.assertTemplateUsed(res, 'horizon/common/_detail.html')
subnets = res.context['subnets_table'].data
- self.assertItemsEqual(subnets, [self.subnets.first()])
+ self.assertCountEqual(subnets, [self.subnets.first()])
self._check_is_extension_supported(
{'network-ip-availability': 2,
diff --git a/openstack_dashboard/dashboards/admin/networks/tests.py b/openstack_dashboard/dashboards/admin/networks/tests.py
index f0223e965..b6f919d87 100644
--- a/openstack_dashboard/dashboards/admin/networks/tests.py
+++ b/openstack_dashboard/dashboards/admin/networks/tests.py
@@ -67,7 +67,7 @@ class NetworkTests(test.BaseAdminViewTests):
self.assertTemplateUsed(res, INDEX_TEMPLATE)
networks = res.context['networks_table'].data
- self.assertItemsEqual(networks, self.networks.list())
+ self.assertCountEqual(networks, self.networks.list())
self.mock_network_list.assert_called_once_with(test.IsHttpRequest())
self.mock_tenant_list.assert_called_once_with(test.IsHttpRequest())
@@ -174,7 +174,7 @@ class NetworkTests(test.BaseAdminViewTests):
self.assertTemplateUsed(res, 'horizon/common/_detail.html')
subnets = res.context['subnets_table'].data
- self.assertItemsEqual(subnets, [self.subnets.first()])
+ self.assertCountEqual(subnets, [self.subnets.first()])
self.mock_show_network_ip_availability.assert_called_once_with(
test.IsHttpRequest(), network.id)
@@ -216,7 +216,7 @@ class NetworkTests(test.BaseAdminViewTests):
self.assertTemplateUsed(res, 'horizon/common/_detail.html')
ports = res.context['ports_table'].data
- self.assertItemsEqual(ports, [self.ports.first()])
+ self.assertCountEqual(ports, [self.ports.first()])
self.assert_mock_multiple_calls_with_same_arguments(
self.mock_network_get, 2,
@@ -263,7 +263,7 @@ class NetworkTests(test.BaseAdminViewTests):
result_agents = res.context['agents_table'].data
expected_agents = self.agents.list()
- self.assertItemsEqual(result_agents, expected_agents)
+ self.assertCountEqual(result_agents, expected_agents)
self._check_is_extension_supported(
{'network-ip-availability': 1,
@@ -404,7 +404,7 @@ class NetworkTests(test.BaseAdminViewTests):
self.assertTemplateUsed(res, 'horizon/common/_detail.html')
subnets = res.context['subnets_table'].data
- self.assertItemsEqual(subnets, [self.subnets.first()])
+ self.assertCountEqual(subnets, [self.subnets.first()])
self.mock_show_network_ip_availability.assert_called_once_with(
test.IsHttpRequest(), network.id)
@@ -966,7 +966,7 @@ class NetworkTests(test.BaseAdminViewTests):
res = self.client.get(reverse('horizon:admin:networks:index'))
self.assertTemplateUsed(res, INDEX_TEMPLATE)
networks = res.context['networks_table'].data
- self.assertItemsEqual(networks, [])
+ self.assertCountEqual(networks, [])
self._check_is_extension_supported(
{'network_availability_zone': 1,
@@ -987,7 +987,7 @@ class NetworkTests(test.BaseAdminViewTests):
res = self.client.get(reverse('horizon:admin:networks:index'))
self.assertTemplateUsed(res, INDEX_TEMPLATE)
networks = res.context['networks_table'].data
- self.assertItemsEqual(networks, [])
+ self.assertCountEqual(networks, [])
self._check_is_extension_supported(
{'network_availability_zone': 2,
diff --git a/openstack_dashboard/dashboards/admin/rbac_policies/tests.py b/openstack_dashboard/dashboards/admin/rbac_policies/tests.py
index 8c9cc342b..8858b7ac8 100644
--- a/openstack_dashboard/dashboards/admin/rbac_policies/tests.py
+++ b/openstack_dashboard/dashboards/admin/rbac_policies/tests.py
@@ -40,7 +40,7 @@ class RBACPolicyTests(test.BaseAdminViewTests):
res = self.client.get(INDEX_URL)
self.assertTemplateUsed(res, INDEX_TEMPLATE)
rbac_policies = res.context['table'].data
- self.assertItemsEqual(rbac_policies, self.rbac_policies.list())
+ self.assertCountEqual(rbac_policies, self.rbac_policies.list())
self.mock_network_list.assert_called_once_with(test.IsHttpRequest())
self.mock_policy_list.assert_called_once_with(test.IsHttpRequest())
self.mock_tenant_list.assert_called_once_with(test.IsHttpRequest())
diff --git a/openstack_dashboard/dashboards/admin/routers/tests.py b/openstack_dashboard/dashboards/admin/routers/tests.py
index 4c25de5b8..28c8dd273 100644
--- a/openstack_dashboard/dashboards/admin/routers/tests.py
+++ b/openstack_dashboard/dashboards/admin/routers/tests.py
@@ -88,7 +88,7 @@ class RouterTests(RouterMixin, r_test.RouterTestCase, test.BaseAdminViewTests):
self.assertTemplateUsed(res, INDEX_TEMPLATE)
routers = res.context['table'].data
- self.assertItemsEqual(routers, self.routers.list())
+ self.assertCountEqual(routers, self.routers.list())
self.mock_router_list.assert_called_once_with(test.IsHttpRequest())
self.mock_tenant_list.assert_called_once_with(test.IsHttpRequest())
@@ -143,7 +143,7 @@ class RouterTests(RouterMixin, r_test.RouterTestCase, test.BaseAdminViewTests):
self.assertTemplateUsed(res, INDEX_TEMPLATE)
routers = res.context['table'].data
- self.assertItemsEqual(routers, self.routers.list())
+ self.assertCountEqual(routers, self.routers.list())
self.mock_agent_list.assert_called_once_with(
test.IsHttpRequest(), id=agent.id)
@@ -305,7 +305,7 @@ class RouterTests(RouterMixin, r_test.RouterTestCase, test.BaseAdminViewTests):
res = self.client.get(self.INDEX_URL)
self.assertTemplateUsed(res, INDEX_TEMPLATE)
routers = res.context['table'].data
- self.assertItemsEqual(routers, [])
+ self.assertCountEqual(routers, [])
self.assert_mock_multiple_calls_with_same_arguments(
self.mock_tenant_quota_usages, 2,
@@ -329,7 +329,7 @@ class RouterTests(RouterMixin, r_test.RouterTestCase, test.BaseAdminViewTests):
res = self.client.get(self.INDEX_URL)
self.assertTemplateUsed(res, INDEX_TEMPLATE)
routers = res.context['table'].data
- self.assertItemsEqual(routers, [])
+ self.assertCountEqual(routers, [])
self.assert_mock_multiple_calls_with_same_arguments(
self.mock_tenant_quota_usages, 2,
diff --git a/openstack_dashboard/dashboards/admin/snapshots/tests.py b/openstack_dashboard/dashboards/admin/snapshots/tests.py
index 200045e18..3403ac721 100644
--- a/openstack_dashboard/dashboards/admin/snapshots/tests.py
+++ b/openstack_dashboard/dashboards/admin/snapshots/tests.py
@@ -42,7 +42,7 @@ class VolumeSnapshotsViewTests(test.BaseAdminViewTests):
self.assertEqual(res.status_code, 200)
self.assertTemplateUsed(res, 'horizon/common/_data_table_view.html')
snapshots = res.context['volume_snapshots_table'].data
- self.assertItemsEqual(snapshots, self.cinder_volume_snapshots.list())
+ self.assertCountEqual(snapshots, self.cinder_volume_snapshots.list())
self.mock_volume_snapshot_list_paged.assert_called_once_with(
test.IsHttpRequest(), paginate=True, marker=None, sort_dir='desc',
@@ -89,7 +89,7 @@ class VolumeSnapshotsViewTests(test.BaseAdminViewTests):
marker=None, sort_dir="desc", snapshots=expected_snapshots,
url=base_url, has_more=True, has_prev=False)
result = res.context['volume_snapshots_table'].data
- self.assertItemsEqual(result, expected_snapshots)
+ self.assertCountEqual(result, expected_snapshots)
# get second page
expected_snapshots = snapshots[size:2 * size]
@@ -99,7 +99,7 @@ class VolumeSnapshotsViewTests(test.BaseAdminViewTests):
marker=marker, sort_dir="desc", snapshots=expected_snapshots,
url=url, has_more=True, has_prev=True)
result = res.context['volume_snapshots_table'].data
- self.assertItemsEqual(result, expected_snapshots)
+ self.assertCountEqual(result, expected_snapshots)
# get last page
expected_snapshots = snapshots[-size:]
@@ -109,7 +109,7 @@ class VolumeSnapshotsViewTests(test.BaseAdminViewTests):
marker=marker, sort_dir="desc", snapshots=expected_snapshots,
url=url, has_more=False, has_prev=True)
result = res.context['volume_snapshots_table'].data
- self.assertItemsEqual(result, expected_snapshots)
+ self.assertCountEqual(result, expected_snapshots)
@override_settings(API_RESULT_PAGE_SIZE=1)
def test_snapshots_index_paginated_prev(self):
@@ -126,7 +126,7 @@ class VolumeSnapshotsViewTests(test.BaseAdminViewTests):
marker=marker, sort_dir="asc", snapshots=expected_snapshots,
url=url, has_more=False, has_prev=True)
snapshots = res.context['volume_snapshots_table'].data
- self.assertItemsEqual(snapshots, expected_snapshots)
+ self.assertCountEqual(snapshots, expected_snapshots)
# back to first page
expected_snapshots = max_snapshots[:size]
@@ -136,7 +136,7 @@ class VolumeSnapshotsViewTests(test.BaseAdminViewTests):
marker=marker, sort_dir="asc", snapshots=expected_snapshots,
url=url, has_more=True, has_prev=False)
snapshots = res.context['volume_snapshots_table'].data
- self.assertItemsEqual(snapshots, expected_snapshots)
+ self.assertCountEqual(snapshots, expected_snapshots)
@test.create_mocks({cinder: ('volume_snapshot_reset_state',
'volume_snapshot_get')})
diff --git a/openstack_dashboard/dashboards/admin/volume_types/tests.py b/openstack_dashboard/dashboards/admin/volume_types/tests.py
index 23ae53c39..e2a44c562 100644
--- a/openstack_dashboard/dashboards/admin/volume_types/tests.py
+++ b/openstack_dashboard/dashboards/admin/volume_types/tests.py
@@ -42,9 +42,9 @@ class VolumeTypeTests(test.BaseAdminViewTests):
self.assertTemplateUsed(
res, 'admin/volume_types/volume_types_tables.html')
volume_types = res.context['volume_types_table'].data
- self.assertItemsEqual(volume_types, self.cinder_volume_types.list())
+ self.assertCountEqual(volume_types, self.cinder_volume_types.list())
qos_specs = res.context['qos_specs_table'].data
- self.assertItemsEqual(qos_specs, self.cinder_qos_specs.list())
+ self.assertCountEqual(qos_specs, self.cinder_qos_specs.list())
self.mock_volume_type_list_with_qos_associations.\
assert_called_once_with(test.IsHttpRequest())
diff --git a/openstack_dashboard/dashboards/admin/volumes/tests.py b/openstack_dashboard/dashboards/admin/volumes/tests.py
index a0855355c..f7bf53f6c 100644
--- a/openstack_dashboard/dashboards/admin/volumes/tests.py
+++ b/openstack_dashboard/dashboards/admin/volumes/tests.py
@@ -70,7 +70,7 @@ class VolumeTests(test.BaseAdminViewTests):
self.mock_tenant_list.assert_called_once()
self.assertTemplateUsed(res, 'horizon/common/_data_table_view.html')
volumes = res.context['volumes_table'].data
- self.assertItemsEqual(volumes, self.cinder_volumes.list())
+ self.assertCountEqual(volumes, self.cinder_volumes.list())
def test_index_without_attachments(self):
self._test_index(True)
@@ -116,7 +116,7 @@ class VolumeTests(test.BaseAdminViewTests):
res = self.client.get(INDEX_URL)
self.assertTemplateUsed(res, 'horizon/common/_data_table_view.html')
volumes = res.context['volumes_table'].data
- self.assertItemsEqual(volumes, [])
+ self.assertCountEqual(volumes, [])
def _ensure_attachments_exist(self, volumes):
volumes = copy.copy(volumes)
@@ -138,7 +138,7 @@ class VolumeTests(test.BaseAdminViewTests):
res = self._test_index_paginated(None, "desc", expected_volumes, url,
True, False)
result = res.context['volumes_table'].data
- self.assertItemsEqual(result, expected_volumes)
+ self.assertCountEqual(result, expected_volumes)
# get second page
expected_volumes = volumes[size:2 * size]
@@ -148,7 +148,7 @@ class VolumeTests(test.BaseAdminViewTests):
res = self._test_index_paginated(marker, "desc", expected_volumes, url,
True, True)
result = res.context['volumes_table'].data
- self.assertItemsEqual(result, expected_volumes)
+ self.assertCountEqual(result, expected_volumes)
# get last page
expected_volumes = volumes[-size:]
@@ -158,7 +158,7 @@ class VolumeTests(test.BaseAdminViewTests):
res = self._test_index_paginated(marker, "desc", expected_volumes, url,
False, True)
result = res.context['volumes_table'].data
- self.assertItemsEqual(result, expected_volumes)
+ self.assertCountEqual(result, expected_volumes)
@override_settings(API_RESULT_PAGE_SIZE=2)
def test_index_paginated_prev(self):
@@ -174,7 +174,7 @@ class VolumeTests(test.BaseAdminViewTests):
res = self._test_index_paginated(marker, "asc", expected_volumes, url,
False, True)
result = res.context['volumes_table'].data
- self.assertItemsEqual(result, expected_volumes)
+ self.assertCountEqual(result, expected_volumes)
# back to first page
expected_volumes = volumes[:size]
@@ -184,7 +184,7 @@ class VolumeTests(test.BaseAdminViewTests):
res = self._test_index_paginated(marker, "asc", expected_volumes, url,
True, False)
result = res.context['volumes_table'].data
- self.assertItemsEqual(result, expected_volumes)
+ self.assertCountEqual(result, expected_volumes)
@test.create_mocks({api.cinder: ['volume_get', 'volume_reset_state']})
def test_update_volume_status(self):
diff --git a/openstack_dashboard/dashboards/identity/domains/tests.py b/openstack_dashboard/dashboards/identity/domains/tests.py
index 5b4f20941..754d669a4 100644
--- a/openstack_dashboard/dashboards/identity/domains/tests.py
+++ b/openstack_dashboard/dashboards/identity/domains/tests.py
@@ -40,7 +40,7 @@ class DomainsViewTests(test.BaseAdminViewTests):
res = self.client.get(DOMAINS_INDEX_URL)
self.assertTemplateUsed(res, constants.DOMAINS_INDEX_VIEW_TEMPLATE)
- self.assertItemsEqual(res.context['table'].data, self.domains.list())
+ self.assertCountEqual(res.context['table'].data, self.domains.list())
self.assertContains(res, 'Create Domain')
self.assertContains(res, 'Edit')
self.assertContains(res, 'Delete Domain')
@@ -58,7 +58,7 @@ class DomainsViewTests(test.BaseAdminViewTests):
res = self.client.get(DOMAINS_INDEX_URL)
self.assertTemplateUsed(res, constants.DOMAINS_INDEX_VIEW_TEMPLATE)
- self.assertItemsEqual(res.context['table'].data, self.domains.list())
+ self.assertCountEqual(res.context['table'].data, self.domains.list())
self.assertNotContains(res, 'Create Domain')
self.assertNotContains(res, 'Edit')
self.assertNotContains(res, 'Delete Domain')
@@ -156,14 +156,14 @@ class DomainsViewTests(test.BaseAdminViewTests):
res = self.client.post(DOMAINS_INDEX_URL, formData)
self.assertTemplateUsed(res, constants.DOMAINS_INDEX_VIEW_TEMPLATE)
- self.assertItemsEqual(res.context['table'].data, [domain, ])
+ self.assertCountEqual(res.context['table'].data, [domain, ])
self.assertContains(res, "<em>another_test_domain:</em>")
formData = {'action': 'domains__clear_domain_context__%s' % domain.id}
res = self.client.post(DOMAINS_INDEX_URL, formData)
self.assertTemplateUsed(res, constants.DOMAINS_INDEX_VIEW_TEMPLATE)
- self.assertItemsEqual(res.context['table'].data, self.domains.list())
+ self.assertCountEqual(res.context['table'].data, self.domains.list())
self.assertNotContains(res, "<em>test_domain:</em>")
self.assertNotContains(res, "<em>another_test_domain:</em>")
diff --git a/openstack_dashboard/dashboards/identity/groups/tests.py b/openstack_dashboard/dashboards/identity/groups/tests.py
index 60d797841..28ec1d20c 100644
--- a/openstack_dashboard/dashboards/identity/groups/tests.py
+++ b/openstack_dashboard/dashboards/identity/groups/tests.py
@@ -55,10 +55,10 @@ class GroupsViewTests(test.BaseAdminViewTests):
res = self.client.get(GROUPS_INDEX_URL)
self.assertTemplateUsed(res, constants.GROUPS_INDEX_VIEW_TEMPLATE)
- self.assertItemsEqual(res.context['table'].data, groups)
+ self.assertCountEqual(res.context['table'].data, groups)
if domain_id:
for group in res.context['table'].data:
- self.assertItemsEqual(group.domain_id, domain_id)
+ self.assertCountEqual(group.domain_id, domain_id)
self.assertContains(res, 'Create Group')
self.assertContains(res, 'Edit')
@@ -83,10 +83,10 @@ class GroupsViewTests(test.BaseAdminViewTests):
res = self.client.get(GROUPS_INDEX_URL)
self.assertTemplateUsed(res, constants.GROUPS_INDEX_VIEW_TEMPLATE)
- self.assertItemsEqual(res.context['table'].data, groups)
+ self.assertCountEqual(res.context['table'].data, groups)
if domain.id:
for group in res.context['table'].data:
- self.assertItemsEqual(group.domain_id, domain.id)
+ self.assertCountEqual(group.domain_id, domain.id)
self.assertContains(res, 'Create Group')
self.assertContains(res, 'Edit')
@@ -110,7 +110,7 @@ class GroupsViewTests(test.BaseAdminViewTests):
res = self.client.get(GROUPS_INDEX_URL)
self.assertTemplateUsed(res, constants.GROUPS_INDEX_VIEW_TEMPLATE)
- self.assertItemsEqual(res.context['table'].data, groups)
+ self.assertCountEqual(res.context['table'].data, groups)
self.assertNotContains(res, 'Create Group')
self.assertNotContains(res, 'Edit')
@@ -239,7 +239,7 @@ class GroupsViewTests(test.BaseAdminViewTests):
res = self.client.get(GROUP_MANAGE_URL)
self.assertTemplateUsed(res, constants.GROUPS_MANAGE_VIEW_TEMPLATE)
- self.assertItemsEqual(res.context['table'].data, group_members)
+ self.assertCountEqual(res.context['table'].data, group_members)
self.mock_group_get.assert_called_once_with(test.IsHttpRequest(),
group.id)
@@ -326,4 +326,4 @@ class GroupsViewTests(test.BaseAdminViewTests):
res = self.client.get(GROUPS_INDEX_URL)
self.assertTemplateUsed(res, constants.GROUPS_INDEX_VIEW_TEMPLATE)
groups = res.context['table'].data
- self.assertItemsEqual(groups, [])
+ self.assertCountEqual(groups, [])
diff --git a/openstack_dashboard/dashboards/identity/identity_providers/tests.py b/openstack_dashboard/dashboards/identity/identity_providers/tests.py
index bf216e55f..e7bbaedad 100644
--- a/openstack_dashboard/dashboards/identity/identity_providers/tests.py
+++ b/openstack_dashboard/dashboards/identity/identity_providers/tests.py
@@ -36,7 +36,7 @@ class IdPsViewTests(test.BaseAdminViewTests):
res = self.client.get(IDPS_INDEX_URL)
self.assertTemplateUsed(res, 'horizon/common/_data_table_view.html')
- self.assertItemsEqual(res.context['table'].data,
+ self.assertCountEqual(res.context['table'].data,
self.identity_providers.list())
self.mock_identity_provider_list.assert_called_once_with(
@@ -145,7 +145,7 @@ class IdPsViewTests(test.BaseAdminViewTests):
self.assertTemplateUsed(
res, 'identity/identity_providers/_detail_overview.html')
self.assertTemplateUsed(res, 'horizon/common/_detail_table.html')
- self.assertItemsEqual(res.context['idp_protocols_table'].data,
+ self.assertCountEqual(res.context['idp_protocols_table'].data,
self.idp_protocols.list())
self.mock_identity_provider_get.assert_called_once_with(
diff --git a/openstack_dashboard/dashboards/identity/mappings/tests.py b/openstack_dashboard/dashboards/identity/mappings/tests.py
index af3392278..990b873b7 100644
--- a/openstack_dashboard/dashboards/identity/mappings/tests.py
+++ b/openstack_dashboard/dashboards/identity/mappings/tests.py
@@ -35,7 +35,7 @@ class MappingsViewTests(test.BaseAdminViewTests):
res = self.client.get(MAPPINGS_INDEX_URL)
self.assertTemplateUsed(res, 'horizon/common/_data_table_view.html')
- self.assertItemsEqual(res.context['table'].data,
+ self.assertCountEqual(res.context['table'].data,
self.idp_mappings.list())
self.mock_mapping_list.assert_called_once_with(test.IsHttpRequest())
diff --git a/openstack_dashboard/dashboards/identity/projects/tests.py b/openstack_dashboard/dashboards/identity/projects/tests.py
index 485d929cc..93ceac359 100644
--- a/openstack_dashboard/dashboards/identity/projects/tests.py
+++ b/openstack_dashboard/dashboards/identity/projects/tests.py
@@ -54,7 +54,7 @@ class TenantsViewTests(test.BaseAdminViewTests):
res = self.client.get(INDEX_URL)
self.assertTemplateUsed(res, 'identity/projects/index.html')
- self.assertItemsEqual(res.context['table'].data, self.tenants.list())
+ self.assertCountEqual(res.context['table'].data, self.tenants.list())
self.mock_tenant_list.assert_called_once_with(test.IsHttpRequest(),
domain=None,
@@ -86,7 +86,7 @@ class TenantsViewTests(test.BaseAdminViewTests):
res = self.client.get(INDEX_URL)
self.assertTemplateUsed(res, 'identity/projects/index.html')
- self.assertItemsEqual(res.context['table'].data, domain_tenants)
+ self.assertCountEqual(res.context['table'].data, domain_tenants)
self.assertContains(res, "<em>test_domain:</em>")
self.mock_tenant_list.assert_called_once_with(test.IsHttpRequest(),
@@ -102,7 +102,7 @@ class TenantsViewTests(test.BaseAdminViewTests):
res = self.client.get(INDEX_URL)
self.assertTemplateUsed(res, 'identity/projects/index.html')
projects = res.context['table'].data
- self.assertItemsEqual(projects, [])
+ self.assertCountEqual(projects, [])
class ProjectsViewNonAdminTests(test.TestCase):
@@ -118,7 +118,7 @@ class ProjectsViewNonAdminTests(test.TestCase):
res = self.client.get(INDEX_URL)
self.assertTemplateUsed(res, 'identity/projects/index.html')
- self.assertItemsEqual(res.context['table'].data, self.tenants.list())
+ self.assertCountEqual(res.context['table'].data, self.tenants.list())
self.mock_tenant_list.assert_called_once_with(test.IsHttpRequest(),
user=self.user.id,
@@ -1466,13 +1466,13 @@ class DetailProjectViewTests(test.BaseAdminViewTests):
users_id_observed = [user.id for user in
res.context["userstable_table"].data]
- self.assertItemsEqual(users_expected.keys(), users_id_observed)
+ self.assertCountEqual(users_expected.keys(), users_id_observed)
# Check the users groups and roles
for user in res.context["userstable_table"].data:
- self.assertItemsEqual(users_expected[user.id]["roles"],
+ self.assertCountEqual(users_expected[user.id]["roles"],
user.roles)
- self.assertItemsEqual(users_expected[user.id]["roles_from_groups"],
+ self.assertCountEqual(users_expected[user.id]["roles_from_groups"],
user.roles_from_groups)
self.mock_tenant_get.assert_called_once_with(test.IsHttpRequest(),
@@ -1571,7 +1571,7 @@ class DetailProjectViewTests(test.BaseAdminViewTests):
res.context["groupstable_table"].data]
# Check the group is displayed
- self.assertItemsEqual(groups_id_observed, groups_expected.keys())
+ self.assertCountEqual(groups_id_observed, groups_expected.keys())
# Check the groups roles
for group in res.context["groupstable_table"].data:
diff --git a/openstack_dashboard/dashboards/identity/roles/tests.py b/openstack_dashboard/dashboards/identity/roles/tests.py
index ebd8cfb81..16ed5356c 100644
--- a/openstack_dashboard/dashboards/identity/roles/tests.py
+++ b/openstack_dashboard/dashboards/identity/roles/tests.py
@@ -40,7 +40,7 @@ class RolesViewTests(test.BaseAdminViewTests):
self.assertContains(res, 'Delete Role')
self.assertTemplateUsed(res, INDEX_TEMPLATE)
- self.assertItemsEqual(res.context['table'].data, self.roles.list())
+ self.assertCountEqual(res.context['table'].data, self.roles.list())
self.mock_role_list.assert_called_once_with(test.IsHttpRequest(),
filters=filters)
@@ -60,7 +60,7 @@ class RolesViewTests(test.BaseAdminViewTests):
self.assertNotContains(res, 'Delete Role')
self.assertTemplateUsed(res, INDEX_TEMPLATE)
- self.assertItemsEqual(res.context['table'].data, self.roles.list())
+ self.assertCountEqual(res.context['table'].data, self.roles.list())
self.mock_role_list.assert_called_once_with(test.IsHttpRequest(),
filters=filters)
@@ -128,4 +128,4 @@ class RolesViewTests(test.BaseAdminViewTests):
res = self.client.get(ROLES_INDEX_URL)
self.assertTemplateUsed(res, INDEX_TEMPLATE)
roles = res.context['table'].data
- self.assertItemsEqual(roles, [])
+ self.assertCountEqual(roles, [])
diff --git a/openstack_dashboard/dashboards/identity/users/tests.py b/openstack_dashboard/dashboards/identity/users/tests.py
index 009f906b6..68fc2affe 100644
--- a/openstack_dashboard/dashboards/identity/users/tests.py
+++ b/openstack_dashboard/dashboards/identity/users/tests.py
@@ -69,11 +69,11 @@ class UsersViewTests(test.BaseAdminViewTests):
res = self.client.get(USERS_INDEX_URL)
self.assertTemplateUsed(res, 'identity/users/index.html')
- self.assertItemsEqual(res.context['table'].data, users)
+ self.assertCountEqual(res.context['table'].data, users)
if domain_id:
for user in res.context['table'].data:
- self.assertItemsEqual(user.domain_id, domain_id)
+ self.assertCountEqual(user.domain_id, domain_id)
if with_domain:
self.mock_get_effective_domain_id.assert_not_called()
@@ -1001,7 +1001,7 @@ class UsersViewTests(test.BaseAdminViewTests):
role_assignments_expected = user_role_assignments
role_assignments_expected.extend(group_role_assignments)
role_assignments_observed = res.context["table"].data
- self.assertItemsEqual(role_assignments_expected,
+ self.assertCountEqual(role_assignments_expected,
role_assignments_observed)
self.mock_domain_get.assert_called_once_with(test.IsHttpRequest(), '1')
@@ -1092,7 +1092,7 @@ class UsersViewTests(test.BaseAdminViewTests):
# Check the table contains the good data
groups_expected = groups
groups_observed = res.context["table"].data
- self.assertItemsEqual(groups_expected, groups_observed)
+ self.assertCountEqual(groups_expected, groups_observed)
self.mock_domain_get.assert_called_once_with(test.IsHttpRequest(), '1')
self.mock_user_get.assert_called_once_with(test.IsHttpRequest(), '1',
@@ -1223,7 +1223,7 @@ class UsersViewTests(test.BaseAdminViewTests):
res = self.client.get(USERS_INDEX_URL)
self.assertTemplateUsed(res, 'identity/users/index.html')
users = res.context['table'].data
- self.assertItemsEqual(users, [])
+ self.assertCountEqual(users, [])
class SeleniumTests(test.SeleniumAdminTestCase):
diff --git a/openstack_dashboard/dashboards/project/backups/tests.py b/openstack_dashboard/dashboards/project/backups/tests.py
index 94d25f05c..8193c0359 100644
--- a/openstack_dashboard/dashboards/project/backups/tests.py
+++ b/openstack_dashboard/dashboards/project/backups/tests.py
@@ -63,7 +63,7 @@ class VolumeBackupsViewTests(test.TestCase):
marker=None, sort_dir="desc", backups=expected_backups,
url=base_url, has_more=True, has_prev=False)
result = res.context['volume_backups_table'].data
- self.assertItemsEqual(result, expected_backups)
+ self.assertCountEqual(result, expected_backups)
# get second page
expected_backups = backups[size:2 * size]
@@ -74,7 +74,7 @@ class VolumeBackupsViewTests(test.TestCase):
marker=marker, sort_dir="desc", backups=expected_backups, url=url,
has_more=True, has_prev=True)
result = res.context['volume_backups_table'].data
- self.assertItemsEqual(result, expected_backups)
+ self.assertCountEqual(result, expected_backups)
self.assertEqual(result[0].snapshot.id, expected_snapshosts[1].id)
# get last page
expected_backups = backups[-size:]
@@ -84,7 +84,7 @@ class VolumeBackupsViewTests(test.TestCase):
marker=marker, sort_dir="desc", backups=expected_backups, url=url,
has_more=False, has_prev=True)
result = res.context['volume_backups_table'].data
- self.assertItemsEqual(result, expected_backups)
+ self.assertCountEqual(result, expected_backups)
@override_settings(API_RESULT_PAGE_SIZE=1)
def test_backups_index_paginated_prev_page(self):
@@ -101,7 +101,7 @@ class VolumeBackupsViewTests(test.TestCase):
marker=marker, sort_dir="asc", backups=expected_backups, url=url,
has_more=True, has_prev=True)
result = res.context['volume_backups_table'].data
- self.assertItemsEqual(result, expected_backups)
+ self.assertCountEqual(result, expected_backups)
# back to first page
expected_backups = backups[:size]
@@ -111,7 +111,7 @@ class VolumeBackupsViewTests(test.TestCase):
marker=marker, sort_dir="asc", backups=expected_backups, url=url,
has_more=True, has_prev=False)
result = res.context['volume_backups_table'].data
- self.assertItemsEqual(result, expected_backups)
+ self.assertCountEqual(result, expected_backups)
@test.create_mocks({api.cinder: ('volume_backup_create',
'volume_snapshot_list',
diff --git a/openstack_dashboard/dashboards/project/instances/tests.py b/openstack_dashboard/dashboards/project/instances/tests.py
index 641847b2e..49e9e933d 100644
--- a/openstack_dashboard/dashboards/project/instances/tests.py
+++ b/openstack_dashboard/dashboards/project/instances/tests.py
@@ -274,7 +274,7 @@ class InstanceTableTests(InstanceTestBase, InstanceTableTestMixin):
self.assertTemplateUsed(res, INDEX_TEMPLATE)
instances = res.context['instances_table'].data
- self.assertItemsEqual(instances, self.servers.list())
+ self.assertCountEqual(instances, self.servers.list())
self.assertNotContains(res, "Launch Instance (Quota exceeded)")
self._check_get_index()
@@ -285,7 +285,7 @@ class InstanceTableTests(InstanceTestBase, InstanceTableTestMixin):
self.assertTemplateUsed(res, INDEX_TEMPLATE)
instances = res.context['instances_table'].data
- self.assertItemsEqual(instances, self.servers.list())
+ self.assertCountEqual(instances, self.servers.list())
self.assertNotContains(res, "Launch Instance (Quota exceeded)")
self._check_get_index(use_servers_update_address=False)
@@ -355,7 +355,7 @@ class InstanceTableTests(InstanceTestBase, InstanceTableTestMixin):
self.assertTemplateUsed(res, INDEX_TEMPLATE)
instances = res.context['instances_table'].data
- self.assertItemsEqual(instances, self.servers.list())
+ self.assertCountEqual(instances, self.servers.list())
self._check_extension_supported({'AdminActions': 20,
'Shelve': 5})
@@ -1506,7 +1506,7 @@ class InstanceDetailTests(InstanceTestBase):
server, volumes_return=volumes,
security_groups_return=security_groups)
- self.assertItemsEqual(res.context['instance'].volumes, volumes)
+ self.assertCountEqual(res.context['instance'].volumes, volumes)
self.mock_is_extension_supported.assert_called_once_with(
helpers.IsHttpRequest(), 'mac-learning')
@@ -1522,7 +1522,7 @@ class InstanceDetailTests(InstanceTestBase):
server, volumes_return=volumes,
security_groups_return=security_groups)
- self.assertItemsEqual(res.context['instance'].volumes, volumes)
+ self.assertCountEqual(res.context['instance'].volumes, volumes)
self.assertEqual(res.context['instance'].volumes[0].device,
"/dev/hda")
self.assertEqual(res.context['instance'].volumes[1].device,
@@ -1571,7 +1571,7 @@ class InstanceDetailTests(InstanceTestBase):
"created": "2013-10-07T00:08:32Z"}
res = self._get_instance_details(server)
- self.assertItemsEqual(res.context['instance'].fault, server.fault)
+ self.assertCountEqual(res.context['instance'].fault, server.fault)
self.mock_is_extension_supported.assert_called_once_with(
helpers.IsHttpRequest(), 'mac-learning')
diff --git a/openstack_dashboard/dashboards/project/key_pairs/tests.py b/openstack_dashboard/dashboards/project/key_pairs/tests.py
index 477513905..8b52f9224 100644
--- a/openstack_dashboard/dashboards/project/key_pairs/tests.py
+++ b/openstack_dashboard/dashboards/project/key_pairs/tests.py
@@ -44,7 +44,7 @@ class KeyPairTests(test.TestCase):
res = self.client.get(INDEX_URL)
self.assertTemplateUsed(res, 'horizon/common/_data_table_view.html')
- self.assertItemsEqual(res.context['keypairs_table'].data, keypairs)
+ self.assertCountEqual(res.context['keypairs_table'].data, keypairs)
self.assert_mock_multiple_calls_with_same_arguments(
self.mock_tenant_quota_usages, 4,
diff --git a/openstack_dashboard/dashboards/project/networks/ports/tests.py b/openstack_dashboard/dashboards/project/networks/ports/tests.py
index b0348797d..4bcb07779 100644
--- a/openstack_dashboard/dashboards/project/networks/ports/tests.py
+++ b/openstack_dashboard/dashboards/project/networks/ports/tests.py
@@ -282,7 +282,7 @@ class NetworkPortTests(test.TestCase):
self.assertTemplateUsed(res, 'horizon/common/_detail.html')
self.assertEqual(res.context['port'].id, port.id)
address_pairs = res.context['allowed_address_pairs_table'].data
- self.assertItemsEqual(port.allowed_address_pairs, address_pairs)
+ self.assertCountEqual(port.allowed_address_pairs, address_pairs)
self.mock_port_get.assert_called_once_with(test.IsHttpRequest(),
port.id)
diff --git a/openstack_dashboard/dashboards/project/networks/tests.py b/openstack_dashboard/dashboards/project/networks/tests.py
index 89b23470f..ffe42d301 100644
--- a/openstack_dashboard/dashboards/project/networks/tests.py
+++ b/openstack_dashboard/dashboards/project/networks/tests.py
@@ -149,7 +149,7 @@ class NetworkTests(test.TestCase, NetworkStubMixin):
res = self.client.get(INDEX_URL)
self.assertTemplateUsed(res, INDEX_TEMPLATE)
networks = res.context['networks_table'].data
- self.assertItemsEqual(networks, self.networks.list())
+ self.assertCountEqual(networks, self.networks.list())
self.mock_tenant_quota_usages.assert_has_calls([
mock.call(test.IsHttpRequest(), targets=('network', )),
@@ -241,7 +241,7 @@ class NetworkTests(test.TestCase, NetworkStubMixin):
self.assertTemplateUsed(res, 'horizon/common/_detail.html')
subnets = res.context['subnets_table'].data
- self.assertItemsEqual(subnets, [self.subnets.first()])
+ self.assertCountEqual(subnets, [self.subnets.first()])
self.mock_network_get.assert_called_once_with(
test.IsHttpRequest(), network_id)
@@ -351,7 +351,7 @@ class NetworkTests(test.TestCase, NetworkStubMixin):
res = self.client.get(url)
self.assertTemplateUsed(res, 'horizon/common/_detail.html')
subnets = res.context['subnets_table'].data
- self.assertItemsEqual(subnets, [self.subnets.first()])
+ self.assertCountEqual(subnets, [self.subnets.first()])
self.mock_network_get.assert_called_once_with(
test.IsHttpRequest(), network_id)
@@ -1113,7 +1113,7 @@ class NetworkViewTests(test.TestCase, NetworkStubMixin):
self.assertTemplateUsed(res, INDEX_TEMPLATE)
networks = res.context['networks_table'].data
- self.assertItemsEqual(networks, self.networks.list())
+ self.assertCountEqual(networks, self.networks.list())
button = find_button_fn(res)
self.assertFalse('disabled' in button.classes,
@@ -1150,7 +1150,7 @@ class NetworkViewTests(test.TestCase, NetworkStubMixin):
self.assertTemplateUsed(res, INDEX_TEMPLATE)
networks = res.context['networks_table'].data
- self.assertItemsEqual(networks, self.networks.list())
+ self.assertCountEqual(networks, self.networks.list())
button = find_button_fn(res)
self.assertIn('disabled', button.classes,
@@ -1224,7 +1224,7 @@ class NetworkViewTests(test.TestCase, NetworkStubMixin):
self.assertTemplateUsed(res, 'horizon/common/_detail.html')
subnets = res.context['subnets_table'].data
- self.assertItemsEqual(subnets, self.subnets.list())
+ self.assertCountEqual(subnets, self.subnets.list())
self.mock_network_get.assert_called_once_with(test.IsHttpRequest(),
network_id)
@@ -1297,7 +1297,7 @@ class NetworkViewTests(test.TestCase, NetworkStubMixin):
self.assertTemplateUsed(res, 'horizon/common/_detail.html')
ports = res.context['ports_table'].data
- self.assertItemsEqual(ports, self.ports.list())
+ self.assertCountEqual(ports, self.ports.list())
self.mock_network_get.assert_called_once_with(
test.IsHttpRequest(), network_id)
diff --git a/openstack_dashboard/dashboards/project/routers/tests.py b/openstack_dashboard/dashboards/project/routers/tests.py
index cd3ccf39b..cc8882c0a 100644
--- a/openstack_dashboard/dashboards/project/routers/tests.py
+++ b/openstack_dashboard/dashboards/project/routers/tests.py
@@ -99,7 +99,7 @@ class RouterTestCase(object):
self.assertTemplateUsed(res, INDEX_TEMPLATE)
routers = res.context['table'].data
- self.assertItemsEqual(routers, self.routers.list())
+ self.assertCountEqual(routers, self.routers.list())
self.mock_router_list.assert_called_once_with(
test.IsHttpRequest(), tenant_id=self.tenant.id)
@@ -176,7 +176,7 @@ class RouterTestCase(object):
self.assertTemplateUsed(res, 'horizon/common/_detail.html')
ports = res.context['interfaces_table'].data
- self.assertItemsEqual(ports, [self.ports.first()])
+ self.assertCountEqual(ports, [self.ports.first()])
self._check_get_detail(router)
@@ -1070,7 +1070,7 @@ class RouterRouteTestCase(object):
self.assertTemplateUsed(res, 'horizon/common/_detail.html')
routes = res.context['extra_routes_table'].data
routes_dict = [r._apidict for r in routes]
- self.assertItemsEqual(routes_dict, router['routes'])
+ self.assertCountEqual(routes_dict, router['routes'])
self._check_get_detail(router, extraroute=True)
@@ -1188,7 +1188,7 @@ class RouterViewTests(RouterMixin, test.TestCase):
self.assertTemplateUsed(res, INDEX_TEMPLATE)
routers = res.context['routers_table'].data
- self.assertItemsEqual(routers, self.routers.list())
+ self.assertCountEqual(routers, self.routers.list())
create_action = self.getAndAssertTableAction(res, 'routers', 'create')
self.assertIn('disabled', create_action.classes,
@@ -1221,7 +1221,7 @@ class RouterViewTests(RouterMixin, test.TestCase):
self.assertTemplateUsed(res, INDEX_TEMPLATE)
routers = res.context['routers_table'].data
- self.assertItemsEqual(routers, self.routers.list())
+ self.assertCountEqual(routers, self.routers.list())
create_action = self.getAndAssertTableAction(res, 'routers', 'create')
self.assertFalse('disabled' in create_action.classes,
@@ -1254,7 +1254,7 @@ class RouterViewTests(RouterMixin, test.TestCase):
self.assertTemplateUsed(res, INDEX_TEMPLATE)
routers = res.context['routers_table'].data
- self.assertItemsEqual(routers, self.routers.list())
+ self.assertCountEqual(routers, self.routers.list())
create_action = self.getAndAssertTableAction(res, 'routers', 'create')
self.assertEqual(set(['ajax-modal']), set(create_action.classes))
diff --git a/openstack_dashboard/dashboards/project/security_groups/tests.py b/openstack_dashboard/dashboards/project/security_groups/tests.py
index 399f6ec1d..27dcf45df 100644
--- a/openstack_dashboard/dashboards/project/security_groups/tests.py
+++ b/openstack_dashboard/dashboards/project/security_groups/tests.py
@@ -78,7 +78,7 @@ class SecurityGroupsViewTests(test.TestCase):
# Security groups
sec_groups_from_ctx = res.context['security_groups_table'].data
# Context data needs to contains all items from the test data.
- self.assertItemsEqual(sec_groups_from_ctx,
+ self.assertCountEqual(sec_groups_from_ctx,
sec_groups)
# Sec groups in context need to be sorted by their ``name`` attribute.
# This assertion is somewhat weak since it's only meaningful as long as
@@ -107,7 +107,7 @@ class SecurityGroupsViewTests(test.TestCase):
res = self.client.get(INDEX_URL)
security_groups = res.context['security_groups_table'].data
- self.assertItemsEqual(security_groups, self.security_groups.list())
+ self.assertCountEqual(security_groups, self.security_groups.list())
create_action = self.getAndAssertTableAction(res, 'security_groups',
'create')
@@ -140,7 +140,7 @@ class SecurityGroupsViewTests(test.TestCase):
res = self.client.get(INDEX_URL)
security_groups = res.context['security_groups_table'].data
- self.assertItemsEqual(security_groups, self.security_groups.list())
+ self.assertCountEqual(security_groups, self.security_groups.list())
create_action = self.getAndAssertTableAction(res, 'security_groups',
'create')
diff --git a/openstack_dashboard/dashboards/project/snapshots/tests.py b/openstack_dashboard/dashboards/project/snapshots/tests.py
index 8606dc037..7a8b5dd4a 100644
--- a/openstack_dashboard/dashboards/project/snapshots/tests.py
+++ b/openstack_dashboard/dashboards/project/snapshots/tests.py
@@ -78,7 +78,7 @@ class VolumeSnapshotsViewTests(test.TestCase):
marker=None, sort_dir="desc", snapshots=expected_snapshots,
url=base_url, has_more=True, has_prev=False)
snapshots = res.context['volume_snapshots_table'].data
- self.assertItemsEqual(snapshots, expected_snapshots)
+ self.assertCountEqual(snapshots, expected_snapshots)
# get second page
expected_snapshots = mock_snapshots[size:2 * size]
@@ -89,7 +89,7 @@ class VolumeSnapshotsViewTests(test.TestCase):
marker=marker, sort_dir="desc", snapshots=expected_snapshots,
url=url, has_more=True, has_prev=True)
snapshots = res.context['volume_snapshots_table'].data
- self.assertItemsEqual(snapshots, expected_snapshots)
+ self.assertCountEqual(snapshots, expected_snapshots)
# get last page
expected_snapshots = mock_snapshots[-size:]
@@ -99,7 +99,7 @@ class VolumeSnapshotsViewTests(test.TestCase):
marker=marker, sort_dir="desc", snapshots=expected_snapshots,
url=url, has_more=False, has_prev=True)
snapshots = res.context['volume_snapshots_table'].data
- self.assertItemsEqual(snapshots, expected_snapshots)
+ self.assertCountEqual(snapshots, expected_snapshots)
@override_settings(API_RESULT_PAGE_SIZE=1)
def test_snapshots_index_with_group(self):
@@ -113,7 +113,7 @@ class VolumeSnapshotsViewTests(test.TestCase):
marker=None, sort_dir="desc", snapshots=expected_snapshots,
url=base_url, has_more=False, has_prev=False, with_groups=True)
snapshots = res.context['volume_snapshots_table'].data
- self.assertItemsEqual(snapshots, mock_snapshots)
+ self.assertCountEqual(snapshots, mock_snapshots)
@override_settings(API_RESULT_PAGE_SIZE=1)
def test_snapshots_index_paginated_prev_page(self):
@@ -130,7 +130,7 @@ class VolumeSnapshotsViewTests(test.TestCase):
marker=marker, sort_dir="asc", snapshots=expected_snapshots,
url=url, has_more=True, has_prev=True)
snapshots = res.context['volume_snapshots_table'].data
- self.assertItemsEqual(snapshots, expected_snapshots)
+ self.assertCountEqual(snapshots, expected_snapshots)
# back to first page
expected_snapshots = mock_snapshots[:size]
@@ -140,7 +140,7 @@ class VolumeSnapshotsViewTests(test.TestCase):
marker=marker, sort_dir="asc", snapshots=expected_snapshots,
url=url, has_more=True, has_prev=False)
snapshots = res.context['volume_snapshots_table'].data
- self.assertItemsEqual(snapshots, expected_snapshots)
+ self.assertCountEqual(snapshots, expected_snapshots)
@test.create_mocks({api.cinder: ('volume_get',),
quotas: ('tenant_quota_usages',)})
diff --git a/openstack_dashboard/dashboards/project/volumes/tests.py b/openstack_dashboard/dashboards/project/volumes/tests.py
index 1fce6d6b4..64a601121 100644
--- a/openstack_dashboard/dashboards/project/volumes/tests.py
+++ b/openstack_dashboard/dashboards/project/volumes/tests.py
@@ -160,7 +160,7 @@ class VolumeIndexViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
res = self._test_index_paginated(None, "desc", expected_volumes, url,
True, False)
result = res.context['volumes_table'].data
- self.assertItemsEqual(result, expected_volumes)
+ self.assertCountEqual(result, expected_volumes)
# get second page
expected_volumes = volumes[size:2 * size]
@@ -170,7 +170,7 @@ class VolumeIndexViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
res = self._test_index_paginated(marker, "desc", expected_volumes, url,
True, True)
result = res.context['volumes_table'].data
- self.assertItemsEqual(result, expected_volumes)
+ self.assertCountEqual(result, expected_volumes)
# get last page
expected_volumes = volumes[-size:]
@@ -180,7 +180,7 @@ class VolumeIndexViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
res = self._test_index_paginated(marker, "desc", expected_volumes, url,
False, True)
result = res.context['volumes_table'].data
- self.assertItemsEqual(result, expected_volumes)
+ self.assertCountEqual(result, expected_volumes)
@override_settings(API_RESULT_PAGE_SIZE=2)
def test_index_paginated_prev_page(self):
@@ -195,7 +195,7 @@ class VolumeIndexViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
res = self._test_index_paginated(marker, "asc", expected_volumes, url,
True, True)
result = res.context['volumes_table'].data
- self.assertItemsEqual(result, expected_volumes)
+ self.assertCountEqual(result, expected_volumes)
# back to first page
expected_volumes = volumes[:size]
@@ -205,7 +205,7 @@ class VolumeIndexViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
res = self._test_index_paginated(marker, "asc", expected_volumes, url,
True, False)
result = res.context['volumes_table'].data
- self.assertItemsEqual(result, expected_volumes)
+ self.assertCountEqual(result, expected_volumes)
class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
@@ -1348,7 +1348,7 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
self.assertTemplateUsed(res, 'horizon/common/_data_table_view.html')
volumes = res.context['volumes_table'].data
- self.assertItemsEqual(volumes, self.cinder_volumes.list())
+ self.assertCountEqual(volumes, self.cinder_volumes.list())
create_action = self.getAndAssertTableAction(res, 'volumes', 'create')
@@ -1392,7 +1392,7 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
self.assertTemplateUsed(res, 'horizon/common/_data_table_view.html')
volumes = res.context['volumes_table'].data
- self.assertItemsEqual(volumes, self.cinder_volumes.list())
+ self.assertCountEqual(volumes, self.cinder_volumes.list())
create_action = self.getAndAssertTableAction(res, 'volumes', 'create')
self.assertIn('disabled', create_action.classes,
diff --git a/openstack_dashboard/test/unit/usage/test_quotas.py b/openstack_dashboard/test/unit/usage/test_quotas.py
index 91baf2b5b..46a5857fe 100644
--- a/openstack_dashboard/test/unit/usage/test_quotas.py
+++ b/openstack_dashboard/test/unit/usage/test_quotas.py
@@ -141,7 +141,7 @@ class QuotaTests(test.APITestCase):
with_volume=True, with_compute=True)
# Compare internal structure of usages to expected.
- self.assertItemsEqual(expected_output, quota_usages.usages)
+ self.assertCountEqual(expected_output, quota_usages.usages)
# Compare available resources
self.assertAvailableQuotasEqual(expected_output, quota_usages.usages)
@@ -179,7 +179,7 @@ class QuotaTests(test.APITestCase):
unlimited_items=unlimited_items)
# Compare internal structure of usages to expected.
- self.assertItemsEqual(expected_output, quota_usages.usages)
+ self.assertCountEqual(expected_output, quota_usages.usages)
# Compare available resources
self.assertAvailableQuotasEqual(expected_output, quota_usages.usages)
@@ -221,7 +221,7 @@ class QuotaTests(test.APITestCase):
expected_quotas = (quotas.CINDER_QUOTA_FIELDS |
quotas.NEUTRON_QUOTA_FIELDS |
quotas.NOVA_QUOTA_FIELDS)
- self.assertItemsEqual(result_quotas, expected_quotas)
+ self.assertCountEqual(result_quotas, expected_quotas)
self._check_service_enabled({'compute': 1, 'network': 1, 'volume': 1})
@@ -238,7 +238,7 @@ class QuotaTests(test.APITestCase):
expected_output = self.get_usages_from_limits(with_volume=False)
# Compare internal structure of usages to expected.
- self.assertItemsEqual(expected_output, quota_usages.usages)
+ self.assertCountEqual(expected_output, quota_usages.usages)
# Make sure that the `in` operator and the `.get()` method
# behave as expected
@@ -265,7 +265,7 @@ class QuotaTests(test.APITestCase):
'cores': {'available': 10, 'used': 0, 'quota': 10}})
# Compare internal structure of usages to expected.
- self.assertItemsEqual(expected_output, quota_usages.usages)
+ self.assertCountEqual(expected_output, quota_usages.usages)
self._check_service_enabled({'compute': 2, 'network': 1, 'volume': 1})
self.mock_tenant_absolute_limits.assert_called_once_with(
@@ -294,7 +294,7 @@ class QuotaTests(test.APITestCase):
'quota': float("inf")}})
# Compare internal structure of usages to expected.
- self.assertItemsEqual(expected_output, quota_usages.usages)
+ self.assertCountEqual(expected_output, quota_usages.usages)
self._check_service_enabled({'compute': 2, 'network': 1, 'volume': 1})
self.mock_nova_tenant_absolute_limits.assert_called_once_with(
@@ -320,7 +320,7 @@ class QuotaTests(test.APITestCase):
expected_output = self.get_usages_from_limits()
# Compare internal structure of usages to expected.
- self.assertItemsEqual(expected_output, quota_usages.usages)
+ self.assertCountEqual(expected_output, quota_usages.usages)
self._check_service_enabled({'compute': 2, 'network': 1, 'volume': 1})
self.mock_nova_tenant_absolute_limits.assert_called_once_with(
@@ -413,7 +413,7 @@ class QuotaTests(test.APITestCase):
expected = dict((k, v) for k, v in expected.items() if k in targets)
# Compare internal structure of usages to expected.
- self.assertItemsEqual(expected, quota_usages.usages)
+ self.assertCountEqual(expected, quota_usages.usages)
# Compare available resources
self.assertAvailableQuotasEqual(expected, quota_usages.usages)