Skip to content

Commit d200fba

Browse files
committed
add more unit tests
1 parent 0836571 commit d200fba

1 file changed

Lines changed: 21 additions & 8 deletions

File tree

integration_test.py

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import os
32
import shutil
43
import pytest
@@ -25,6 +24,8 @@ def copy_target_to_temp(tmp_path):
2524

2625
@pytest.fixture
2726
def execute_happy_path(tmp_path, copy_target_to_temp):
27+
"""Executes script under test, then copies test files into SUT folder structure.
28+
Finally, executes SUT again to get the file operations done."""
2829
execute_target(tmp_path)
2930
copy_dummy_content_to_temp(tmp_path)
3031
execute_target(tmp_path)
@@ -85,10 +86,22 @@ def test_creates_files_from_dummy(tmp_path, execute_happy_path):
8586
d = p / '03'
8687
assert len(os.listdir(d)) == 7
8788

88-
# def test_creates_correct_filenames(tmp_path):
89-
# execute_happy_path(tmp_path)
90-
# for w in range(1, 4):
91-
# p = tmp_path / SDCARDFOLDER / ('0' + str(w))
92-
# for x in range(1, 8):
93-
# d = p / ('00' + str(x))
94-
# assert d.exists()
89+
90+
def test_creates_correct_filenames(tmp_path, execute_happy_path):
91+
# 3 test playlists
92+
for w in range(1, 4):
93+
path = tmp_path / SDCARDFOLDER / ('0' + str(w))
94+
# 7 tracks per test playlist
95+
for x in range(1, 8):
96+
filename = '00' + str(x) + '.mp3'
97+
print(filename)
98+
file = path / filename
99+
assert file.exists()
100+
101+
102+
def test_renames_playlists_align_folder_numbers(tmp_path, execute_happy_path):
103+
playlists = os.listdir(PLAYLISTFOLDER)
104+
playlist_number = 0
105+
for playlist in playlists:
106+
playlist_number = playlist_number + 1
107+
assert playlist.find(str(playlist_number), 0, 2) != -1

0 commit comments

Comments
 (0)