add option to add filepath to the current session
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
from pydantic import ValidationError
|
||||
|
||||
@@ -9,6 +11,38 @@ from delta_barth.errors import (
|
||||
from delta_barth.types import HttpRequestTypes
|
||||
|
||||
|
||||
def test_validate_path_Success():
|
||||
str_pth = str(Path.cwd())
|
||||
path = common.validate_path(str_pth)
|
||||
assert path.name == Path.cwd().name
|
||||
|
||||
|
||||
def test_validate_path_FailNotExisting():
|
||||
str_pth = str(Path.cwd() / "test")
|
||||
with pytest.raises(FileNotFoundError, match=r"seems not to exist"):
|
||||
_ = common.validate_path(str_pth)
|
||||
|
||||
|
||||
def test_validate_path_FailNoDirectory(tmp_path):
|
||||
file = tmp_path / "test.txt"
|
||||
file.write_text("test", encoding="utf-8")
|
||||
|
||||
str_pth = str(file)
|
||||
with pytest.raises(FileNotFoundError, match=r"seems not to be a directory"):
|
||||
_ = common.validate_path(str_pth)
|
||||
|
||||
|
||||
def test_session_set_DataPath(tmp_path):
|
||||
str_path = str(tmp_path)
|
||||
session = common.Session(HTTP_BASE_CONTENT_HEADERS)
|
||||
|
||||
assert session._data_path is None
|
||||
|
||||
session.set_data_path(str_path)
|
||||
assert session._data_path is not None
|
||||
assert isinstance(session.data_path, Path)
|
||||
|
||||
|
||||
def test_validate_creds(credentials):
|
||||
creds = common.validate_credentials(
|
||||
username=credentials["user"],
|
||||
|
||||
Reference in New Issue
Block a user