Skip to content

Commit

Permalink
test(import): Add test for _paths_from_logfile method
Browse files Browse the repository at this point in the history
  • Loading branch information
Holzhaus committed Jun 27, 2022
1 parent 99ced5c commit 6c81679
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/test_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import platform
import sys
import unittest
import textwrap

from unittest.mock import patch, Mock
from test import _common
Expand Down Expand Up @@ -729,6 +730,25 @@ def test_quiet_timid_disallowed(self):
self.assertRaises(ui.UserError, commands.import_files, None, [],
None)

def test_parse_paths_from_logfile(self):
logfile = os.path.join(self.temp_dir, b"logfile.log")
with open(logfile, mode="w") as fp:
fp.write(textwrap.dedent(
"""
import started Wed Jun 15 23:08:26 2022
asis /music/Beatles, The/The Beatles; /music/Beatles, The/The Beatles/CD 01; /music/Beatles, The/The Beatles/CD 02
duplicate-replace /music/Bill Evans/Trio '65
skip /music/Michael Jackson/Bad
skip /music/Soulwax/Any Minute Now
"""
).strip())

self.assertEqual(list(commands._paths_from_logfile(logfile)), [
"/music/Beatles, The/The Beatles",
"/music/Michael Jackson/Bad",
"/music/Soulwax/Any Minute Now",
])


@_common.slow_test()
class ConfigTest(unittest.TestCase, TestHelper, _common.Assertions):
Expand Down

0 comments on commit 6c81679

Please sign in to comment.