mirror of
https://github.com/dtomlinson91/tembo.git
synced 2025-12-22 07:35:45 +00:00
adding latest
This commit is contained in:
@@ -5,7 +5,11 @@ import pytest
|
||||
|
||||
import tembo.exceptions
|
||||
import tembo.cli
|
||||
from tembo.cli.cli import _new_verify_name_exists, _new_get_config_scope
|
||||
from tembo.cli.cli import (
|
||||
_new_verify_name_exists,
|
||||
_new_get_config_scope,
|
||||
_new_show_example,
|
||||
)
|
||||
|
||||
|
||||
def test_cli_page_is_saved_success():
|
||||
@@ -107,7 +111,6 @@ def test_new_get_config_scope_success(shared_datadir):
|
||||
|
||||
|
||||
def test_new_get_config_scope_key_not_found(shared_datadir):
|
||||
# arrange
|
||||
# arrange
|
||||
os.environ["TEMBO_CONFIG"] = str(shared_datadir / "config" / "missing_keys")
|
||||
importlib.reload(tembo.cli)
|
||||
@@ -122,3 +125,25 @@ def test_new_get_config_scope_key_not_found(shared_datadir):
|
||||
assert (
|
||||
str(mandatory_key_not_found.value) == "Key 'filename' not found in config.yml"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"path,message",
|
||||
[
|
||||
("success", "[TEMBO] Example for some_scope: tembo new some_scope 🐘\n"),
|
||||
("optional_keys", "[TEMBO] No example in config.yml 🐘\n"),
|
||||
],
|
||||
)
|
||||
def test_new_show_example(path, message, shared_datadir, capsys):
|
||||
# arrange
|
||||
os.environ["TEMBO_CONFIG"] = str(shared_datadir / "config" / path)
|
||||
importlib.reload(tembo.cli)
|
||||
config_scope = _new_get_config_scope("some_scope")
|
||||
|
||||
# act
|
||||
with pytest.raises(SystemExit) as system_exit:
|
||||
_new_show_example(True, config_scope)
|
||||
|
||||
# assert
|
||||
assert capsys.readouterr().out == message
|
||||
assert system_exit.value.code == 0
|
||||
|
||||
Reference in New Issue
Block a user