Closes https://github.com/jmbannon/ytdl-sub/issues/1394 Should help debug user issues like https://github.com/jmbannon/ytdl-sub/issues/1148 Checks permissions on the following: - working directory - output directory - cookiefile (if specified) And will fail immediately with a verbose message.
20 lines
644 B
Python
20 lines
644 B
Python
import pytest
|
|
|
|
from ytdl_sub.utils.file_handler import FileHandler
|
|
from ytdl_sub.utils.system import IS_WINDOWS
|
|
|
|
|
|
class TestFileHandler:
|
|
|
|
def test_directory_exists(self):
|
|
if IS_WINDOWS:
|
|
return
|
|
|
|
assert FileHandler.is_path_writable("/tmp")
|
|
assert FileHandler.is_path_writable("/tmp/")
|
|
assert FileHandler.is_path_writable("/tmp/non-existent")
|
|
assert FileHandler.is_path_writable("/tmp/non-existent/")
|
|
assert FileHandler.is_path_writable("/tmp/non-existent/nested")
|
|
|
|
assert not FileHandler.is_path_writable("/lol-in-root")
|
|
assert not FileHandler.is_path_writable("/")
|