Esempio n. 1
0
    def test_get_available_themes_metadata(self, pkg_resources_mock, get_theme_metadata_mock):
        pkg_resources_mock.iter_entry_points.return_value = ()

        result = real_get_available_themes(metadata=True)

        self.assertEqual(len(result), len(CORE_THEMES))
        self.assertEqual(get_theme_metadata_mock.call_count, len(CORE_THEMES))
Esempio n. 2
0
    def test_get_available_themes_metadata(self, pkg_resources_mock,
                                           get_theme_metadata_mock):
        pkg_resources_mock.iter_entry_points.return_value = ()

        result = real_get_available_themes(metadata=True)

        self.assertEqual(len(result), len(CORE_THEMES))
        self.assertEqual(get_theme_metadata_mock.call_count, len(CORE_THEMES))
Esempio n. 3
0
    def test_get_available_themes_third_party_themes(self, pkg_resources_mock):
        ep1_mock = Mock()
        ep1_mock.load.return_value = Mock(__name__="thridpartytheme")
        ep2_mock = Mock()
        ep2_mock.load.return_value = Mock(__name__="thridpartytheme2")

        pkg_resources_mock.iter_entry_points.return_value = (ep1_mock, ep2_mock)
        self.assertEqual(real_get_available_themes(), list(CORE_THEMES) + ["thridpartytheme", "thridpartytheme2"])
Esempio n. 4
0
    def test_get_available_themes_third_party_themes(self, pkg_resources_mock):
        ep1_mock = Mock()
        ep1_mock.load.return_value = Mock(__name__="thridpartytheme")
        ep2_mock = Mock()
        ep2_mock.load.return_value = Mock(__name__="thridpartytheme2")

        pkg_resources_mock.iter_entry_points.return_value = (ep1_mock,
                                                             ep2_mock)
        self.assertEqual(
            real_get_available_themes(),
            list(CORE_THEMES) + ["thridpartytheme", "thridpartytheme2"])
Esempio n. 5
0
 def test_get_available_themes_customtheme(self, pkg_resources_mock):
     pkg_resources_mock.iter_entry_points.return_value = ()
     self.assertEqual(real_get_available_themes(),
                      list(CORE_THEMES) + ["customtheme"])
Esempio n. 6
0
 def test_get_available_themes_customtheme(self, pkg_resources_mock):
     pkg_resources_mock.iter_entry_points.return_value = ()
     self.assertEqual(real_get_available_themes(), list(CORE_THEMES) + ["customtheme"])