assertItemsEqual with six.assertCountEqual
This commit is contained in:
Ayub khan
2019-08-21 16:26:12 +05:00
parent acf3cb684d
commit 8a95a8e520
43 changed files with 167 additions and 103 deletions

View File

@@ -3,6 +3,7 @@ Tests for Management commands of comprehensive theming.
"""
from __future__ import absolute_import
import six
from django.core.management import CommandError, call_command
from django.test import TestCase
@@ -44,12 +45,16 @@ class TestUpdateAssets(TestCase):
"""
# make sure compile_sass picks all themes when called with 'themes=all' option
parsed_args = Command.parse_arguments(themes=["all"])
self.assertItemsEqual(parsed_args[2], get_themes())
six.assertCountEqual(self, parsed_args[2], get_themes())
# make sure compile_sass picks no themes when called with 'themes=no' option
parsed_args = Command.parse_arguments(themes=["no"])
self.assertItemsEqual(parsed_args[2], [])
six.assertCountEqual(self, parsed_args[2], [])
# make sure compile_sass picks only specified themes
parsed_args = Command.parse_arguments(themes=["test-theme"])
self.assertItemsEqual(parsed_args[2], [theme for theme in get_themes() if theme.theme_dir_name == "test-theme"])
six.assertCountEqual(
self,
parsed_args[2],
[theme for theme in get_themes() if theme.theme_dir_name == "test-theme"]
)

View File

@@ -3,6 +3,7 @@ Test helpers for Comprehensive Theming.
"""
from __future__ import absolute_import
import six
from django.conf import settings
from django.test import TestCase, override_settings
from edx_django_utils.cache import RequestCache
@@ -38,7 +39,7 @@ class TestHelpers(TestCase):
Theme('test-theme', 'test-theme', get_theme_base_dir('test-theme'), settings.PROJECT_ROOT),
]
actual_themes = get_themes()
self.assertItemsEqual(expected_themes, actual_themes)
six.assertCountEqual(self, expected_themes, actual_themes)
@override_settings(COMPREHENSIVE_THEME_DIRS=[settings.TEST_THEME.dirname()])
def test_get_themes_2(self):
@@ -49,7 +50,7 @@ class TestHelpers(TestCase):
Theme('test-theme', 'test-theme', get_theme_base_dir('test-theme'), settings.PROJECT_ROOT),
]
actual_themes = get_themes()
self.assertItemsEqual(expected_themes, actual_themes)
six.assertCountEqual(self, expected_themes, actual_themes)
def test_get_value_returns_override(self):
"""