def test_get_sass_directories(self):
        """
        Test that proper sass dirs are returned by get_sass_directories
        """
        themes_dir = Path(settings.COMPREHENSIVE_THEME_DIR)

        expected_directories = [
            {
                "sass_source_dir": Path("ecommerce/static/sass/base"),
                "css_destination_dir": Path("ecommerce/static/css/base"),
                "lookup_paths": SYSTEM_SASS_PATHS,
            },
            {
                "sass_source_dir": Path("ecommerce/static/sass/base"),
                "css_destination_dir": themes_dir / "test-theme" / "static" / "css" / "base",
                "lookup_paths": [themes_dir / "test-theme" / "static" / "sass" / "partials"] + SYSTEM_SASS_PATHS,
            },
            {
                "sass_source_dir": Path("ecommerce/static/sass/base"),
                "css_destination_dir": themes_dir / "test-theme-2" / "static" / "css" / "base",
                "lookup_paths": [themes_dir / "test-theme-2" / "static" / "sass" / "partials"] + SYSTEM_SASS_PATHS,
            },
            {
                "sass_source_dir": themes_dir / "test-theme-2" / "static" / "sass" / "base",
                "css_destination_dir": themes_dir / "test-theme-2" / "static" / "css" / "base",
                "lookup_paths": [themes_dir / "test-theme-2" / "static" / "sass" / "partials"] + SYSTEM_SASS_PATHS,
            }
        ]

        returned_dirs = get_sass_directories(themes=self.themes, system=True)
        self.assertItemsEqual(expected_directories, returned_dirs)
Пример #2
0
    def test_get_sass_directories(self):
        """
        Test that proper sass dirs are returned by get_sass_directories
        """
        themes_dirs = settings.COMPREHENSIVE_THEME_DIRS

        expected_directories = [
            {
                "sass_source_dir": Path("ecommerce/static/sass/base"),
                "css_destination_dir": Path("ecommerce/static/css/base"),
                "lookup_paths": SYSTEM_SASS_PATHS,
            },
            {
                "sass_source_dir":
                Path("ecommerce/static/sass/base"),
                "css_destination_dir":
                themes_dirs[0] / "test-theme" / "static" / "css" / "base",
                "lookup_paths": [
                    themes_dirs[0] / "test-theme" / "static" / "sass" /
                    "partials"
                ] + SYSTEM_SASS_PATHS,
            },
            {
                "sass_source_dir":
                Path("ecommerce/static/sass/base"),
                "css_destination_dir":
                themes_dirs[0] / "test-theme-2" / "static" / "css" / "base",
                "lookup_paths": [
                    themes_dirs[0] / "test-theme-2" / "static" / "sass" /
                    "partials"
                ] + SYSTEM_SASS_PATHS,
            },
            {
                "sass_source_dir":
                themes_dirs[0] / "test-theme-2" / "static" / "sass" / "base",
                "css_destination_dir":
                themes_dirs[0] / "test-theme-2" / "static" / "css" / "base",
                "lookup_paths": [
                    themes_dirs[0] / "test-theme-2" / "static" / "sass" /
                    "partials"
                ] + SYSTEM_SASS_PATHS,
            },
            {
                "sass_source_dir":
                Path("ecommerce/static/sass/base"),
                "css_destination_dir":
                themes_dirs[1] / "test-theme-3" / "static" / "css" / "base",
                "lookup_paths": [
                    themes_dirs[1] / "test-theme-3" / "static" / "sass" /
                    "partials"
                ] + SYSTEM_SASS_PATHS,
            },
        ]

        returned_dirs = get_sass_directories(themes=self.themes, system=True)
        six.assertCountEqual(self, expected_directories, returned_dirs)
    def test_get_sass_directories_with_no_themes(self):
        """
        Test that get_sass_directories returns only system sass directories when called
        with empty list of themes and system=True
        """
        expected_directories = [
            {
                "sass_source_dir": Path("ecommerce/static/sass/base"),
                "css_destination_dir": Path("ecommerce/static/css/base"),
                "lookup_paths": SYSTEM_SASS_PATHS,
            }
        ]

        returned_dirs = get_sass_directories(themes=[], system=True)
        self.assertItemsEqual(expected_directories, returned_dirs)
Пример #4
0
    def test_get_sass_directories_with_no_themes(self):
        """
        Test that get_sass_directories returns only system sass directories when called
        with empty list of themes and system=True
        """
        expected_directories = [
            {
                "sass_source_dir": Path("ecommerce/static/sass/base"),
                "css_destination_dir": Path("ecommerce/static/css/base"),
                "lookup_paths": SYSTEM_SASS_PATHS,
            }
        ]

        returned_dirs = get_sass_directories(themes=[], system=True)
        self.assertItemsEqual(expected_directories, returned_dirs)