コード例 #1
0
ファイル: test_pluginmanager.py プロジェクト: jkunle/paul
    def find_plugins_test(self):
        """
        Test the find_plugins() method to ensure it imports the correct plugins
        """
        # GIVEN: A plugin manager
        plugin_manager = PluginManager()

        # WHEN: We mock out sys.platform to make it return "darwin" and then find the plugins
        old_platform = sys.platform
        sys.platform = 'darwin'
        plugin_manager.find_plugins()
        sys.platform = old_platform

        # THEN: We should find the "Songs", "Bibles", etc in the plugins list
        plugin_names = [plugin.name for plugin in plugin_manager.plugins]
        self.assertIn('songs', plugin_names,
                      'There should be a "songs" plugin')
        self.assertIn('bibles', plugin_names,
                      'There should be a "bibles" plugin')
        self.assertIn('presentations', plugin_names,
                      'There should be a "presentations" plugin')
        self.assertIn('images', plugin_names,
                      'There should be a "images" plugin')
        self.assertIn('media', plugin_names,
                      'There should be a "media" plugin')
        self.assertIn('custom', plugin_names,
                      'There should be a "custom" plugin')
        self.assertIn('songusage', plugin_names,
                      'There should be a "songusage" plugin')
        self.assertIn('alerts', plugin_names,
                      'There should be a "alerts" plugin')
        self.assertIn('remotes', plugin_names,
                      'There should be a "remotes" plugin')
コード例 #2
0
    def find_plugins_test(self):
        """
        Test the find_plugins() method to ensure it imports the correct plugins
        """
        # GIVEN: A plugin manager
        plugin_manager = PluginManager()

        # WHEN: We mock out sys.platform to make it return "darwin" and then find the plugins
        old_platform = sys.platform
        sys.platform = 'darwin'
        plugin_manager.find_plugins()
        sys.platform = old_platform

        # THEN: We should find the "Songs", "Bibles", etc in the plugins list
        plugin_names = [plugin.name for plugin in plugin_manager.plugins]
        self.assertIn('songs', plugin_names, 'There should be a "songs" plugin')
        self.assertIn('bibles', plugin_names, 'There should be a "bibles" plugin')
        self.assertIn('presentations', plugin_names, 'There should be a "presentations" plugin')
        self.assertIn('images', plugin_names, 'There should be a "images" plugin')
        self.assertIn('media', plugin_names, 'There should be a "media" plugin')
        self.assertIn('custom', plugin_names, 'There should be a "custom" plugin')
        self.assertIn('songusage', plugin_names, 'There should be a "songusage" plugin')
        self.assertIn('alerts', plugin_names, 'There should be a "alerts" plugin')
        self.assertIn('remotes', plugin_names, 'There should be a "remotes" plugin')
コード例 #3
0
ファイル: test_pluginmanager.py プロジェクト: simhnna/openlp
    def test_find_plugins(self, mocked_is1, mocked_is2, mocked_is3, mocked_is4,
                          mocked_is5, mocked_is6):
        """
        Test the find_plugins() method to ensure it imports the correct plugins
        """
        # GIVEN: A plugin manager
        plugin_manager = PluginManager()

        # WHEN: We mock out sys.platform to make it return "darwin" and then find the plugins
        old_platform = sys.platform
        sys.platform = 'darwin'
        plugin_manager.find_plugins()
        sys.platform = old_platform

        # THEN: We should find the "Songs", "Bibles", etc in the plugins list
        plugin_names = [plugin.name for plugin in plugin_manager.plugins]
        assert 'songs' in plugin_names, 'There should be a "songs" plugin'
        assert 'bibles' in plugin_names, 'There should be a "bibles" plugin'
        assert 'presentations' in plugin_names, 'There should be a "presentations" plugin'
        assert 'images' in plugin_names, 'There should be a "images" plugin'
        assert 'media' in plugin_names, 'There should be a "media" plugin'
        assert 'custom' in plugin_names, 'There should be a "custom" plugin'
        assert 'songusage' in plugin_names, 'There should be a "songusage" plugin'
        assert 'alerts' in plugin_names, 'There should be a "alerts" plugin'