|
@@ -133,3 +133,30 @@ def test_sync_play_count_callback(tmpdir, tracks_dir_path):
|
|
|
play_count_added_cb=play_count_added_cb)
|
|
|
play_count_added_cb.assert_called_once_with(
|
|
|
track_a2, ('symuid:pcnt:cmus:lib1:0', ['21']))
|
|
|
+
|
|
|
+
|
|
|
+def test_sync_play_count_callback_main(capsys, tmpdir, tracks_dir_path):
|
|
|
+ shutil.copyfile(
|
|
|
+ src=os.path.join(tracks_dir_path, 'id3v2.4-empty.mp3'),
|
|
|
+ dst=tmpdir.join('a1.mp3'),
|
|
|
+ )
|
|
|
+ shutil.copyfile(
|
|
|
+ src=os.path.join(tracks_dir_path, 'ogg-vorbis-empty.ogg'),
|
|
|
+ dst=tmpdir.join('a2.ogg'),
|
|
|
+ )
|
|
|
+ uuid_a = generate_uuid4_bytes()
|
|
|
+ track_a1 = Track(tmpdir.join('a1.mp3'))
|
|
|
+ track_a1.assign_uuid(uuid_a)
|
|
|
+ track_a2 = Track(tmpdir.join('a2.ogg'))
|
|
|
+ track_a2.assign_uuid(uuid_a)
|
|
|
+ track_a1.register_play_count(PlayCount(
|
|
|
+ player='cmus',
|
|
|
+ library_id='lib1',
|
|
|
+ register_dt=unix_epoch_time_to_datetime_utc(0),
|
|
|
+ count=21,
|
|
|
+ ))
|
|
|
+ with unittest.mock.patch('sys.argv', ['', tmpdir.strpath]):
|
|
|
+ _main()
|
|
|
+ out, _ = capsys.readouterr()
|
|
|
+ assert out == "{!r}: added play count tag ('symuid:pcnt:cmus:lib1:0', ['21'])\n" \
|
|
|
+ .format(track_a2.path)
|