mirror of
https://github.com/dtomlinson91/tembo.git
synced 2025-12-22 08:35:44 +00:00
adding latest tests
This commit is contained in:
@@ -15,7 +15,7 @@ def test_page_creator_convert_to_path_missing_base_path(caplog):
|
||||
|
||||
# act
|
||||
with pytest.raises(SystemExit) as system_exit:
|
||||
PageCreator._convert_to_path(
|
||||
PageCreator._convert_base_path_to_path(
|
||||
base_path=base_path,
|
||||
page_path=page_path,
|
||||
filename=filename,
|
||||
@@ -50,7 +50,7 @@ def test_page_creator_convert_to_path_full_path_to_file(
|
||||
base_path = tmpdir
|
||||
|
||||
# act
|
||||
converted_path = PageCreator._convert_to_path(
|
||||
converted_path = PageCreator._convert_base_path_to_path(
|
||||
base_path, page_path, filename, extension
|
||||
)
|
||||
|
||||
@@ -67,7 +67,7 @@ def test_page_creator_convert_to_path_full_path_no_file(tmpdir):
|
||||
extension = ""
|
||||
|
||||
# act
|
||||
converted_path = PageCreator._convert_to_path(
|
||||
converted_path = PageCreator._convert_base_path_to_path(
|
||||
base_path, page_path, filename, extension
|
||||
)
|
||||
|
||||
|
||||
@@ -1,13 +1,31 @@
|
||||
import pytest
|
||||
|
||||
from tembo.journal.pages import PageCreatorOptions
|
||||
from tembo.journal.pages import PageCreatorOptions, ScopedPageCreator
|
||||
|
||||
|
||||
def test_scoped_page_creator_create_page_missing_base_path():
|
||||
def test_create_page_base_path_does_not_exist(tmpdir, caplog):
|
||||
# arrange
|
||||
options = PageCreatorOptions()
|
||||
base_path = str(tmpdir / "nonexistent" / "path")
|
||||
options = PageCreatorOptions(
|
||||
base_path=base_path,
|
||||
page_path="",
|
||||
filename="",
|
||||
extension="",
|
||||
name="",
|
||||
user_input=None,
|
||||
example=None,
|
||||
template_filename=None,
|
||||
template_path=None,
|
||||
)
|
||||
|
||||
# act
|
||||
with pytest.raises(SystemExit) as system_exit:
|
||||
scoped_page_creator = ScopedPageCreator().create_page(options)
|
||||
|
||||
# assert
|
||||
pass
|
||||
assert system_exit.value.code == 1
|
||||
assert (
|
||||
caplog.records[0].message
|
||||
== f"Tembo base path of {base_path} does not exist - exiting"
|
||||
)
|
||||
assert caplog.records[0].levelname == "CRITICAL"
|
||||
|
||||
Reference in New Issue
Block a user