Skip to content

Commit

Permalink
tests: Add tests for files with same name to multi-directory testcases
Browse files Browse the repository at this point in the history
  • Loading branch information
Holzhaus committed Jan 29, 2019
1 parent 00a490f commit 4ac1687
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions tests/test_extrafiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class BaseTestCase(unittest.TestCase):
'extrafiles': {
'patterns': {
'log': ['*.log'],
'cue': ['*.cue'],
'cue': ['*.cue', '*/*.cue'],
'artwork': ['scans/', 'Scans/', 'artwork/', 'Artwork/'],
},
'paths': {
Expand Down Expand Up @@ -68,8 +68,10 @@ def setUp(self):
os.path.join(RSRC, 'full.mp3'),
os.path.join(sourcedir, 'CD2', 'file.mp3'),
)
for filename in ('file.cue', 'file.txt', 'file.log'):
for filename in ('file.txt', 'file.log'):
self._create_example_file(sourcedir, filename)
for discdir in ('CD1', 'CD2'):
self._create_example_file(sourcedir, discdir, 'file.cue')
self._create_artwork_files(sourcedir, 'scans')

# Set up plugin instance
Expand Down Expand Up @@ -177,7 +179,8 @@ def testMoveFilesMultiple(self):

# Check source directory
assert os.path.exists(os.path.join(sourcedir, 'file.txt'))
assert not os.path.exists(os.path.join(sourcedir, 'file.cue'))
assert not os.path.exists(os.path.join(sourcedir, 'CD1', 'file.cue'))
assert not os.path.exists(os.path.join(sourcedir, 'CD2', 'file.cue'))
assert not os.path.exists(os.path.join(sourcedir, 'file.log'))
assert not os.path.exists(os.path.join(sourcedir, 'audio.log'))

Expand All @@ -186,7 +189,8 @@ def testMoveFilesMultiple(self):

# Check destination directory
assert not os.path.exists(os.path.join(destdir, 'file.txt'))
assert os.path.exists(os.path.join(destdir, 'file.cue'))
assert not os.path.exists(os.path.join(sourcedir, 'CD1_file.cue'))
assert not os.path.exists(os.path.join(sourcedir, 'CD2_file.cue'))
assert not os.path.exists(os.path.join(destdir, 'file.log'))
assert os.path.exists(os.path.join(destdir, 'audio.log'))

Expand Down Expand Up @@ -267,7 +271,8 @@ def testCopyFilesMultiple(self):

# Check source directory
assert os.path.exists(os.path.join(sourcedir, 'file.txt'))
assert os.path.exists(os.path.join(sourcedir, 'file.cue'))
assert os.path.exists(os.path.join(sourcedir, 'CD1', 'file.cue'))
assert os.path.exists(os.path.join(sourcedir, 'CD2', 'file.cue'))
assert os.path.exists(os.path.join(sourcedir, 'file.log'))
assert not os.path.exists(os.path.join(sourcedir, 'audio.log'))

Expand All @@ -278,7 +283,8 @@ def testCopyFilesMultiple(self):

# Check destination directory
assert not os.path.exists(os.path.join(destdir, 'file.txt'))
assert os.path.exists(os.path.join(destdir, 'file.cue'))
assert os.path.exists(os.path.join(destdir, 'CD1_file.cue'))
assert os.path.exists(os.path.join(destdir, 'CD2_file.cue'))
assert not os.path.exists(os.path.join(destdir, 'file.log'))
assert os.path.exists(os.path.join(destdir, 'audio.log'))

Expand Down

0 comments on commit 4ac1687

Please sign in to comment.