Exemplo n.º 1
0
    def test_message_when_invalid(self):
        config['format_item'] = u'$artist - $album - $title'
        config['format_album'] = u'$albumartist - $album'

        # Test album with invalid mb_albumid.
        # The default format for an album include $albumartist so
        # set that here, too.
        album_invalid = Item(
            albumartist=u'album info',
            album=u'album info',
            mb_albumid=u'a1b2c3d4',
            path=''
        )
        self.lib.add_album([album_invalid])

        # default format
        with capture_log('beets.mbsync') as logs:
            self.run_command('mbsync')
        e = u'mbsync: Skipping album with invalid mb_albumid: ' + \
            u'album info - album info'
        self.assertEqual(e, logs[0])

        # custom format
        with capture_log('beets.mbsync') as logs:
            self.run_command('mbsync', '-f', "'$album'")
        e = u"mbsync: Skipping album with invalid mb_albumid: 'album info'"
        self.assertEqual(e, logs[0])

        # restore the config
        config['format_item'] = u'$artist - $album - $title'
        config['format_album'] = u'$albumartist - $album'

        # Test singleton with invalid mb_trackid.
        # The default singleton format includes $artist and $album
        # so we need to stub them here
        item_invalid = Item(
            artist=u'album info',
            album=u'album info',
            title=u'old title',
            mb_trackid=u'a1b2c3d4',
            path='',
        )
        self.lib.add(item_invalid)

        # default format
        with capture_log('beets.mbsync') as logs:
            self.run_command('mbsync')
        e = u'mbsync: Skipping singleton with invalid mb_trackid: ' + \
            u'album info - album info - old title'
        self.assertEqual(e, logs[0])

        # custom format
        with capture_log('beets.mbsync') as logs:
            self.run_command('mbsync', '-f', "'$title'")
        e = u"mbsync: Skipping singleton with invalid mb_trackid: 'old title'"
        self.assertEqual(e, logs[0])
Exemplo n.º 2
0
    def test_message_when_invalid(self):
        config['format_item'] = u'$artist - $album - $title'
        config['format_album'] = u'$albumartist - $album'

        # Test album with invalid mb_albumid.
        # The default format for an album include $albumartist so
        # set that here, too.
        album_invalid = Item(albumartist=u'album info',
                             album=u'album info',
                             mb_albumid=u'a1b2c3d4',
                             path='')
        self.lib.add_album([album_invalid])

        # default format
        with capture_log('beets.mbsync') as logs:
            self.run_command('mbsync')
        e = u'mbsync: Skipping album with invalid mb_albumid: ' + \
            u'album info - album info'
        self.assertEqual(e, logs[0])

        # custom format
        with capture_log('beets.mbsync') as logs:
            self.run_command('mbsync', '-f', "'$album'")
        e = u"mbsync: Skipping album with invalid mb_albumid: 'album info'"
        self.assertEqual(e, logs[0])

        # restore the config
        config['format_item'] = u'$artist - $album - $title'
        config['format_album'] = u'$albumartist - $album'

        # Test singleton with invalid mb_trackid.
        # The default singleton format includes $artist and $album
        # so we need to stub them here
        item_invalid = Item(
            artist=u'album info',
            album=u'album info',
            title=u'old title',
            mb_trackid=u'a1b2c3d4',
            path='',
        )
        self.lib.add(item_invalid)

        # default format
        with capture_log('beets.mbsync') as logs:
            self.run_command('mbsync')
        e = u'mbsync: Skipping singleton with invalid mb_trackid: ' + \
            u'album info - album info - old title'
        self.assertEqual(e, logs[0])

        # custom format
        with capture_log('beets.mbsync') as logs:
            self.run_command('mbsync', '-f', "'$title'")
        e = u"mbsync: Skipping singleton with invalid mb_trackid: 'old title'"
        self.assertEqual(e, logs[0])
Exemplo n.º 3
0
    def test_command_logging(self):
        self.config['verbose'] = 0
        with helper.capture_log() as logs:
            self.run_command('dummy')
        self.assertIn('dummy: warning cmd', logs)
        self.assertIn('dummy: info cmd', logs)
        self.assertNotIn('dummy: debug cmd', logs)

        for level in (1, 2):
            self.config['verbose'] = level
            with helper.capture_log() as logs:
                self.run_command('dummy')
            self.assertIn('dummy: warning cmd', logs)
            self.assertIn('dummy: info cmd', logs)
            self.assertIn('dummy: debug cmd', logs)
Exemplo n.º 4
0
 def test_listener_level2(self):
     self.config['verbose'] = 2
     with helper.capture_log() as logs:
         plugins.send('dummy_event')
     self.assertIn(u'dummy: warning listener', logs)
     self.assertIn(u'dummy: info listener', logs)
     self.assertIn(u'dummy: debug listener', logs)
Exemplo n.º 5
0
 def test_command_level1(self):
     self.config['verbose'] = 1
     with helper.capture_log() as logs:
         self.run_command('dummy')
     self.assertIn(u'dummy: warning cmd', logs)
     self.assertIn(u'dummy: info cmd', logs)
     self.assertIn(u'dummy: debug cmd', logs)
Exemplo n.º 6
0
 def test_listener_level2(self):
     self.config['verbose'] = 2
     with helper.capture_log() as logs:
         plugins.send('dummy_event')
     self.assertIn(u'dummy: warning listener', logs)
     self.assertIn(u'dummy: info listener', logs)
     self.assertIn(u'dummy: debug listener', logs)
Exemplo n.º 7
0
 def test_command_level1(self):
     self.config['verbose'] = 1
     with helper.capture_log() as logs:
         self.run_command('dummy')
     self.assertIn(u'dummy: warning cmd', logs)
     self.assertIn(u'dummy: info cmd', logs)
     self.assertIn(u'dummy: debug cmd', logs)
    def test_plugin_version(self):
        with capture_log(plg_log_ns) as logs:
            self.runcli(PLUGIN_NAME, "--version")

        versioninfo = "{pt}({pn}) plugin for Beets: v{ver}".format(
            pt=PACKAGE_TITLE, pn=PACKAGE_NAME, ver=PLUGIN_VERSION)
        self.assertIn(versioninfo, "\n".join(logs))
Exemplo n.º 9
0
    def test_parse_release_without_required_fields(self):
        """Test parsing of a release that does not have the required fields."""
        release = Bag(data={}, refresh=lambda *args: None)
        with capture_log() as logs:
            d = DiscogsPlugin().get_album_info(release)

        self.assertEqual(d, None)
        self.assertIn('Release does not contain the required fields', logs[0])
Exemplo n.º 10
0
    def test_parse_release_without_required_fields(self):
        """Test parsing of a release that does not have the required fields."""
        release = Bag(data={}, refresh=lambda *args: None)
        with capture_log() as logs:
            d = DiscogsPlugin().get_album_info(release)

        self.assertEqual(d, None)
        self.assertIn('Release does not contain the required fields', logs[0])
Exemplo n.º 11
0
 def test_import_stage_level2(self):
     self.config['verbose'] = 2
     with helper.capture_log() as logs:
         importer = self.create_importer()
         importer.run()
     self.assertIn(u'dummy: warning import_stage', logs)
     self.assertIn(u'dummy: info import_stage', logs)
     self.assertIn(u'dummy: debug import_stage', logs)
Exemplo n.º 12
0
 def test_import_stage_level2(self):
     self.config['verbose'] = 2
     with helper.capture_log() as logs:
         importer = self.create_importer()
         importer.run()
     self.assertIn(u'dummy: warning import_stage', logs)
     self.assertIn(u'dummy: info import_stage', logs)
     self.assertIn(u'dummy: debug import_stage', logs)
Exemplo n.º 13
0
    def test_itunesstore_no_result(self):
        json = '{"results": []}'
        self.mock_response(fetchart.ITunesStore.API_URL, json)
        expected = u"got no results"

        with capture_log('beets.test_art') as logs:
            with self.assertRaises(StopIteration):
                next(self.source.get(self.album, self.settings, []))
        self.assertIn(expected, logs[1])
Exemplo n.º 14
0
    def test_hook_non_zero_exit(self):
        self._add_hook('test_event', 'sh -c "exit 1"')

        self.load_plugins('hook')

        with capture_log('beets.hook') as logs:
            plugins.send('test_event')

        self.assertIn('hook: hook for test_event exited with status 1', logs)
Exemplo n.º 15
0
    def test_hook_empty_command(self):
        self._add_hook('test_event', '')

        self.load_plugins('hook')

        with capture_log('beets.hook') as logs:
            plugins.send('test_event')

        self.assertIn('hook: invalid command ""', logs)
Exemplo n.º 16
0
    def test_itunesstore_requestexception(self):
        responses.add(responses.GET, fetchart.ITunesStore.API_URL,
                      json={'error': 'not found'}, status=404)
        expected = u'iTunes search failed: 404 Client Error'

        with capture_log('beets.test_art') as logs:
            with self.assertRaises(StopIteration):
                next(self.source.get(self.album, self.settings, []))
        self.assertIn(expected, logs[1])
Exemplo n.º 17
0
    def test_itunesstore_returns_no_result_when_error_received(self):
        json = '{"error": {"errors": [{"reason": "some reason"}]}}'
        self.mock_response(fetchart.ITunesStore.API_URL, json)
        expected = u"not found in json. Fields are"

        with capture_log('beets.test_art') as logs:
            with self.assertRaises(StopIteration):
                next(self.source.get(self.album, self.settings, []))
        self.assertIn(expected, logs[1])
Exemplo n.º 18
0
    def test_itunesstore_returns_no_result_with_malformed_response(self):
        json = """bla blup"""
        self.mock_response(fetchart.ITunesStore.API_URL, json)
        expected = u"Could not decode json response:"

        with capture_log('beets.test_art') as logs:
            with self.assertRaises(StopIteration):
                next(self.source.get(self.album, self.settings, []))
        self.assertIn(expected, logs[1])
Exemplo n.º 19
0
    def test_itunesstore_returns_no_result_with_malformed_response(self):
        json = """bla blup"""
        self.mock_response(fetchart.ITunesStore.API_URL, json)
        expected = u"Could not decode json response:"

        with capture_log('beets.test_art') as logs:
            with self.assertRaises(StopIteration):
                next(self.source.get(self.album, self.settings, []))
        self.assertIn(expected, logs[1])
Exemplo n.º 20
0
    def test_itunesstore_no_result(self):
        json = '{"results": []}'
        self.mock_response(fetchart.ITunesStore.API_URL, json)
        expected = u"got no results"

        with capture_log('beets.test_art') as logs:
            with self.assertRaises(StopIteration):
                next(self.source.get(self.album, self.settings, []))
        self.assertIn(expected, logs[1])
Exemplo n.º 21
0
    def test_itunesstore_returns_no_result_when_error_received(self):
        json = '{"error": {"errors": [{"reason": "some reason"}]}}'
        self.mock_response(fetchart.ITunesStore.API_URL, json)
        expected = u"not found in json. Fields are"

        with capture_log('beets.test_art') as logs:
            with self.assertRaises(StopIteration):
                next(self.source.get(self.album, self.settings, []))
        self.assertIn(expected, logs[1])
Exemplo n.º 22
0
    def test_itunesstore_requestexception(self):
        responses.add(responses.GET, fetchart.ITunesStore.API_URL,
                      json={'error': 'not found'}, status=404)
        expected = u'iTunes search failed: 404 Client Error'

        with capture_log('beets.test_art') as logs:
            with self.assertRaises(StopIteration):
                next(self.source.get(self.album, self.settings, []))
        self.assertIn(expected, logs[1])
Exemplo n.º 23
0
    def test_message_when_skipping(self):
        config["format_item"] = u"$artist - $album - $title"
        config["format_album"] = u"$albumartist - $album"

        # Test album with no mb_albumid.
        # The default format for an album include $albumartist so
        # set that here, too.
        album_invalid = Item(albumartist=u"album info", album=u"album info", path="")
        self.lib.add_album([album_invalid])

        # default format
        with capture_log("beets.mbsync") as logs:
            self.run_command("mbsync")
        e = u"mbsync: Skipping album with no mb_albumid: " + u"album info - album info"
        self.assertEqual(e, logs[0])

        # custom format
        with capture_log("beets.mbsync") as logs:
            self.run_command("mbsync", "-f", "'$album'")
        e = u"mbsync: Skipping album with no mb_albumid: 'album info'"
        self.assertEqual(e, logs[0])

        # restore the config
        config["format_item"] = "$artist - $album - $title"
        config["format_album"] = "$albumartist - $album"

        # Test singleton with no mb_trackid.
        # The default singleton format includes $artist and $album
        # so we need to stub them here
        item_invalid = Item(artist=u"album info", album=u"album info", title=u"old title", path="")
        self.lib.add(item_invalid)

        # default format
        with capture_log("beets.mbsync") as logs:
            self.run_command("mbsync")
        e = u"mbsync: Skipping singleton with no mb_trackid: " + u"album info - album info - old title"
        self.assertEqual(e, logs[0])

        # custom format
        with capture_log("beets.mbsync") as logs:
            self.run_command("mbsync", "-f", "'$title'")
        e = u"mbsync: Skipping singleton with no mb_trackid: 'old title'"
        self.assertEqual(e, logs[0])
Exemplo n.º 24
0
    def test_do_not_print_ignored_by_default(self):
        config['copyartifacts']['extensions'] = '.file'

        with helper.capture_log() as logs:
            self._run_importer()

        self.assert_not_in_lib_dir('Tag Artist', 'Tag Album', 'artifact.file2')

        # check output log
        logs = [line for line in logs if line.startswith('copyartifacts:')]
        self.assertEqual(logs, [])
Exemplo n.º 25
0
    def test_hook_non_existent_command(self):
        self._add_hook('test_event', 'non-existent-command')

        self.load_plugins('hook')

        with capture_log('beets.hook') as logs:
            plugins.send('test_event')

        self.assertTrue(any(
            message.startswith("hook: hook for test_event failed: ")
            for message in logs))
Exemplo n.º 26
0
    def test_root_logger_levels(self):
        """Root logger level should be shared between threads.
        """
        self.config['threaded'] = True

        blog.getLogger('beets').set_global_level(blog.WARNING)
        with helper.capture_log() as logs:
            importer = self.create_importer()
            importer.run()
        self.assertEqual(logs, [])

        blog.getLogger('beets').set_global_level(blog.INFO)
        with helper.capture_log() as logs:
            importer = self.create_importer()
            importer.run()
        for l in logs:
            self.assertIn(u"import", l)
            self.assertIn(u"album", l)

        blog.getLogger('beets').set_global_level(blog.DEBUG)
        with helper.capture_log() as logs:
            importer = self.create_importer()
            importer.run()
        self.assertIn(u"Sending event: database_change", logs)
Exemplo n.º 27
0
    def __run(self, expected_lines, singletons=False):
        self.load_plugins('filefilter')

        import_files = [self.import_dir]
        self._setup_import_session(singletons=singletons)
        self.importer.paths = import_files

        with capture_log() as logs:
            self.importer.run()
        self.unload_plugins()
        FileFilterPlugin.listeners = None

        logs = [line for line in logs if not line.startswith('Sending event:')]

        self.assertEqual(logs, expected_lines)
Exemplo n.º 28
0
    def __run(self, expected_lines, singletons=False):
        self.load_plugins('filefilter')

        import_files = [self.import_dir]
        self._setup_import_session(singletons=singletons)
        self.importer.paths = import_files

        with capture_log() as logs:
            self.importer.run()
        self.unload_plugins()
        FileFilterPlugin.listeners = None

        logs = [line for line in logs if not line.startswith('Sending event:')]

        self.assertEqual(logs, expected_lines)
Exemplo n.º 29
0
    def test_root_logger_levels(self):
        """Root logger level should be shared between threads.
        """
        self.config['threaded'] = True

        blog.getLogger('beets').set_global_level(blog.WARNING)
        with helper.capture_log() as logs:
            importer = self.create_importer()
            importer.run()
        self.assertEqual(logs, [])

        blog.getLogger('beets').set_global_level(blog.INFO)
        with helper.capture_log() as logs:
            importer = self.create_importer()
            importer.run()
        for l in logs:
            self.assertIn(u"import", l)
            self.assertIn(u"album", l)

        blog.getLogger('beets').set_global_level(blog.DEBUG)
        with helper.capture_log() as logs:
            importer = self.create_importer()
            importer.run()
        self.assertIn(u"Sending event: database_change", logs)
Exemplo n.º 30
0
    def test_itunesstore_returns_result_without_artwork(self):
        json = """{
                    "results":
                        [
                            {
                                "artistName": "some artist",
                                "collectionName": "some album"
                            }
                        ]
                  }"""
        self.mock_response(fetchart.ITunesStore.API_URL, json)
        expected = u'Malformed itunes candidate'

        with capture_log('beets.test_art') as logs:
            with self.assertRaises(StopIteration):
                next(self.source.get(self.album, self.settings, []))
        self.assertIn(expected, logs[1])
Exemplo n.º 31
0
    def test_itunesstore_returns_result_without_artwork(self):
        json = """{
                    "results":
                        [
                            {
                                "artistName": "some artist",
                                "collectionName": "some album"
                            }
                        ]
                  }"""
        self.mock_response(fetchart.ITunesStore.API_URL, json)
        expected = u'Malformed itunes candidate'

        with capture_log('beets.test_art') as logs:
            with self.assertRaises(StopIteration):
                next(self.source.get(self.album, self.settings, []))
        self.assertIn(expected, logs[1])
Exemplo n.º 32
0
    def test_malformed_output(self, call_patch):
        # Return malformed XML (the ampersand should be &)
        call_patch.return_value = """
            <album>
                <track total="1" number="1" file="&">
                    <integrated lufs="0" lu="0" />
                    <sample-peak spfs="0" factor="0" />
                </track>
            </album>
        """

        with capture_log('beets.replaygain') as logs:
            self.run_command('replaygain')

        # Count how many lines match the expected error.
        matching = [line for line in logs if 'malformed XML' in line]

        self.assertEqual(len(matching), 2)
Exemplo n.º 33
0
    def test_import_task_created(self):
        import_files = [self.import_dir]
        self._setup_import_session(singletons=False)
        self.importer.paths = import_files

        with helper.capture_log() as logs:
            self.importer.run()
        self.unload_plugins()

        # Exactly one event should have been imported (for the album).
        # Sentinels do not get emitted.
        self.assertEqual(logs.count('Sending event: import_task_created'), 1)

        logs = [line for line in logs if not line.startswith('Sending event:')]
        self.assertEqual(logs, [
            'Album: {0}'.format(os.path.join(self.import_dir, 'album')),
            '  {0}'.format(self.file_paths[0]),
            '  {0}'.format(self.file_paths[1]),
        ])
Exemplo n.º 34
0
    def test_import_task_created(self):
        import_files = [self.import_dir]
        self._setup_import_session(singletons=False)
        self.importer.paths = import_files

        with helper.capture_log() as logs:
            self.importer.run()
        self.unload_plugins()

        # Exactly one event should have been imported (for the album).
        # Sentinels do not get emitted.
        self.assertEqual(logs.count('Sending event: import_task_created'), 1)

        logs = [line for line in logs if not line.startswith('Sending event:')]
        self.assertEqual(logs, [
            'Album: {0}'.format(os.path.join(self.import_dir, 'album')),
            '  {0}'.format(self.file_paths[0]),
            '  {0}'.format(self.file_paths[1]),
        ])
Exemplo n.º 35
0
    def test_import_task_created_with_plugin(self):
        class ToSingletonPlugin(plugins.BeetsPlugin):
            def __init__(self):
                super(ToSingletonPlugin, self).__init__()

                self.register_listener('import_task_created',
                                       self.import_task_created_event)

            def import_task_created_event(self, session, task):
                if isinstance(task, SingletonImportTask) \
                        or isinstance(task, SentinelImportTask)\
                        or isinstance(task, ArchiveImportTask):
                    return task

                new_tasks = []
                for item in task.items:
                    new_tasks.append(SingletonImportTask(task.toppath, item))

                return new_tasks

        to_singleton_plugin = ToSingletonPlugin
        self.register_plugin(to_singleton_plugin)

        import_files = [self.import_dir]
        self._setup_import_session(singletons=False)
        self.importer.paths = import_files

        with helper.capture_log() as logs:
            self.importer.run()
        self.unload_plugins()

        # Exactly one event should have been imported (for the album).
        # Sentinels do not get emitted.
        self.assertEqual(logs.count(u'Sending event: import_task_created'), 1)

        logs = [
            line for line in logs if not line.startswith(u'Sending event:')
        ]
        self.assertEqual(logs, [
            u'Singleton: {0}'.format(self.file_paths[0]),
            u'Singleton: {0}'.format(self.file_paths[1]),
        ])
Exemplo n.º 36
0
    def test_import_task_created_with_plugin(self):
        class ToSingletonPlugin(plugins.BeetsPlugin):
            def __init__(self):
                super(ToSingletonPlugin, self).__init__()

                self.register_listener('import_task_created',
                                       self.import_task_created_event)

            def import_task_created_event(self, session, task):
                if isinstance(task, SingletonImportTask) \
                        or isinstance(task, SentinelImportTask)\
                        or isinstance(task, ArchiveImportTask):
                    return task

                new_tasks = []
                for item in task.items:
                    new_tasks.append(SingletonImportTask(task.toppath, item))

                return new_tasks

        to_singleton_plugin = ToSingletonPlugin
        self.register_plugin(to_singleton_plugin)

        import_files = [self.import_dir]
        self._setup_import_session(singletons=False)
        self.importer.paths = import_files

        with helper.capture_log() as logs:
            self.importer.run()
        self.unload_plugins()

        # Exactly one event should have been imported (for the album).
        # Sentinels do not get emitted.
        self.assertEqual(logs.count(u'Sending event: import_task_created'), 1)

        logs = [line for line in logs if not line.startswith(
            u'Sending event:')]
        self.assertEqual(logs, [
            u'Singleton: {0}'.format(displayable_path(self.file_paths[0])),
            u'Singleton: {0}'.format(displayable_path(self.file_paths[1])),
        ])
Exemplo n.º 37
0
    def test_update_library(self, track_for_id, album_for_id):
        album_for_id.return_value = \
            generate_album_info(
                'album id',
                [('track id', {'release_track_id': u'release track id'})]
            )
        track_for_id.return_value = \
            generate_track_info(u'singleton track id',
                                {'title': u'singleton info'})

        album_item = Item(
            album=u'old title',
            mb_albumid=u'81ae60d4-5b75-38df-903a-db2cfa51c2c6',
            mb_trackid=u'old track id',
            mb_releasetrackid=u'release track id',
            path=''
        )
        album = self.lib.add_album([album_item])

        item = Item(
            title=u'old title',
            mb_trackid=u'b8c2cf90-83f9-3b5f-8ccd-31fb866fcf37',
            path='',
        )
        self.lib.add(item)

        with capture_log() as logs:
            self.run_command('mbsync')

        self.assertIn('Sending event: albuminfo_received', logs)
        self.assertIn('Sending event: trackinfo_received', logs)

        item.load()
        self.assertEqual(item.title, u'singleton info')

        album_item.load()
        self.assertEqual(album_item.title, u'track info')
        self.assertEqual(album_item.mb_trackid, u'track id')

        album.load()
        self.assertEqual(album.album, u'album info')
Exemplo n.º 38
0
    def test_update_library(self, track_for_id, album_for_id):
        album_for_id.return_value = \
            generate_album_info(
                'album id',
                [('track id', {'release_track_id': u'release track id'})]
            )
        track_for_id.return_value = \
            generate_track_info(u'singleton track id',
                                {'title': u'singleton info'})

        album_item = Item(album=u'old title',
                          mb_albumid=u'81ae60d4-5b75-38df-903a-db2cfa51c2c6',
                          mb_trackid=u'old track id',
                          mb_releasetrackid=u'release track id',
                          path='')
        album = self.lib.add_album([album_item])

        item = Item(
            title=u'old title',
            mb_trackid=u'b8c2cf90-83f9-3b5f-8ccd-31fb866fcf37',
            path='',
        )
        self.lib.add(item)

        with capture_log() as logs:
            self.run_command('mbsync')

        self.assertIn('Sending event: albuminfo_received', logs)
        self.assertIn('Sending event: trackinfo_received', logs)

        item.load()
        self.assertEqual(item.title, u'singleton info')

        album_item.load()
        self.assertEqual(album_item.title, u'track info')
        self.assertEqual(album_item.mb_trackid, u'track id')

        album.load()
        self.assertEqual(album.album, u'album info')
Exemplo n.º 39
0
 def test_empty_query(self):
     with capture_log('beets.convert') as logs:
         self.run_convert('An impossible query')
     self.assertEqual(logs[0], u'convert: Empty query result.')
 def test_run_plugin(self):
     with capture_log(plg_log_ns) as logs:
         self.runcli(PLUGIN_NAME)
     self.assertIn("Your query did not produce any results.",
                   "\n".join(logs))
 def test_run_plugin(self):
     with capture_log(plg_log_ns) as logs:
         self.runcli(PLUGIN_NAME)
     self.assertIn("template: Your journey starts here...", "\n".join(logs))
Exemplo n.º 42
0
 def test_empty_query(self):
     with capture_log('beets.convert') as logs:
         self.run_convert('An impossible query')
     self.assertEqual(logs[0], u'convert: Empty query result.')
Exemplo n.º 43
0
    def test_say(self):
        test_message = "one two three"

        with capture_log() as logs:
            common.say(test_message)
        self.assertIn(test_message, '\n'.join(logs))