class TestThemeFinders(TestCase):
    """
    Test comprehensive theming static files finders.
    """
    def setUp(self):
        super().setUp()
        self.finder = ThemeFilesFinder()

    def test_find_first_themed_asset(self):
        """
        Verify Theme Finder returns themed assets
        """
        themes_dir = settings.COMPREHENSIVE_THEME_DIRS[1]
        asset = "test-theme/images/logo.png"
        match = self.finder.find(asset)

        assert match == ((((
            (themes_dir / 'test-theme') / 'lms') / 'static') / 'images') /
                         'logo.png')

    def test_find_all_themed_asset(self):
        """
        Verify Theme Finder returns themed assets
        """
        themes_dir = settings.COMPREHENSIVE_THEME_DIRS[1]

        asset = "test-theme/images/logo.png"
        matches = self.finder.find(asset, all=True)

        # Make sure only first match was returned
        assert 1 == len(matches)

        assert matches[0] == ((((
            (themes_dir / 'test-theme') / 'lms') / 'static') / 'images') /
                              'logo.png')

    def test_find_in_theme(self):
        """
        Verify find in theme method of finders returns asset from specified theme
        """
        themes_dir = settings.COMPREHENSIVE_THEME_DIRS[1]

        asset = "images/logo.png"
        match = self.finder.find_in_theme("test-theme", asset)

        assert match == ((((
            (themes_dir / 'test-theme') / 'lms') / 'static') / 'images') /
                         'logo.png')
예제 #2
0
파일: test_finders.py 프로젝트: saadow123/1
class TestThemeFinders(TestCase):
    """
    Test comprehensive theming static files finders.
    """
    def setUp(self):
        super(TestThemeFinders, self).setUp()
        self.finder = ThemeFilesFinder()

    def test_find_first_themed_asset(self):
        """
        Verify Theme Finder returns themed assets
        """
        themes_dir = settings.COMPREHENSIVE_THEME_DIRS[1]
        asset = "test-theme/images/logo.png"
        match = self.finder.find(asset)

        self.assertEqual(
            match, themes_dir / "test-theme" / "lms" / "static" / "images" /
            "logo.png")

    def test_find_all_themed_asset(self):
        """
        Verify Theme Finder returns themed assets
        """
        themes_dir = settings.COMPREHENSIVE_THEME_DIRS[1]

        asset = "test-theme/images/logo.png"
        matches = self.finder.find(asset, all=True)

        # Make sure only first match was returned
        self.assertEqual(1, len(matches))

        self.assertEqual(
            matches[0], themes_dir / "test-theme" / "lms" / "static" /
            "images" / "logo.png")

    def test_find_in_theme(self):
        """
        Verify find in theme method of finders returns asset from specified theme
        """
        themes_dir = settings.COMPREHENSIVE_THEME_DIRS[1]

        asset = "images/logo.png"
        match = self.finder.find_in_theme("test-theme", asset)

        self.assertEqual(
            match, themes_dir / "test-theme" / "lms" / "static" / "images" /
            "logo.png")
예제 #3
0
class TestThemeFinders(TestCase):
    """
    Test comprehensive theming static files finders.
    """

    def setUp(self):
        super(TestThemeFinders, self).setUp()
        self.finder = ThemeFilesFinder()

    def test_find_first_themed_asset(self):
        """
        Verify Theme Finder returns themed assets
        """
        themes_dir = settings.COMPREHENSIVE_THEME_DIRS[1]
        asset = "test-theme/images/logo.png"
        match = self.finder.find(asset)

        self.assertEqual(match, themes_dir / "test-theme" / "lms" / "static" / "images" / "logo.png")

    def test_find_all_themed_asset(self):
        """
        Verify Theme Finder returns themed assets
        """
        themes_dir = settings.COMPREHENSIVE_THEME_DIRS[1]

        asset = "test-theme/images/logo.png"
        matches = self.finder.find(asset, all=True)

        # Make sure only first match was returned
        self.assertEqual(1, len(matches))

        self.assertEqual(matches[0], themes_dir / "test-theme" / "lms" / "static" / "images" / "logo.png")

    def test_find_in_theme(self):
        """
        Verify find in theme method of finders returns asset from specified theme
        """
        themes_dir = settings.COMPREHENSIVE_THEME_DIRS[1]

        asset = "images/logo.png"
        match = self.finder.find_in_theme("test-theme", asset)

        self.assertEqual(match, themes_dir / "test-theme" / "lms" / "static" / "images" / "logo.png")
예제 #4
0
 def setUp(self):
     super(TestThemeFinders, self).setUp()
     self.finder = ThemeFilesFinder()
예제 #5
0
 def setUp(self):
     super(TestThemeFinders, self).setUp()  # lint-amnesty, pylint: disable=super-with-arguments
     self.finder = ThemeFilesFinder()
예제 #6
0
 def setUp(self):
     super(TestThemeFinders, self).setUp()
     self.finder = ThemeFilesFinder()
 def setUp(self):
     super().setUp()
     self.finder = ThemeFilesFinder()