Fix #1105: Can now launch server import from the UI

This commit is contained in:
Agate 2020-08-03 10:16:25 +02:00
parent 0a93aec8c9
commit 788c12748f
17 changed files with 476 additions and 6 deletions

View file

@ -1,5 +1,5 @@
import os
import pathlib
import pytest
from funkwhale_api.music import utils
@ -91,3 +91,21 @@ def test_increment_downloads_count_already_tracked(
assert upload.downloads_count == 0
assert upload.track.downloads_count == 0
@pytest.mark.parametrize(
"path,expected",
[
("", [{"name": "Magic", "dir": True}, {"name": "System", "dir": True}]),
("Magic", [{"name": "file.mp3", "dir": False}]),
("System", [{"name": "file.ogg", "dir": False}]),
],
)
def test_get_dirs_and_files(path, expected, tmpdir):
root_path = pathlib.Path(tmpdir)
(root_path / "Magic").mkdir()
(root_path / "Magic" / "file.mp3").touch()
(root_path / "System").mkdir()
(root_path / "System" / "file.ogg").touch()
assert utils.browse_dir(root_path, path) == expected