-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8d17f11
commit 4c243d1
Showing
5 changed files
with
123 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from pathlib import Path | ||
|
||
import pytest | ||
from typer.testing import CliRunner | ||
|
||
from spiel import Options | ||
from spiel.load import load_deck_and_options | ||
from spiel.main import app | ||
|
||
|
||
def test_init_cli_command_fails_if_file_exists(runner: CliRunner, tmp_path: Path) -> None: | ||
target = tmp_path / "foo_bar.py" | ||
target.touch() | ||
|
||
result = runner.invoke(app, ["init", str(target)]) | ||
|
||
assert result.exit_code == 1 | ||
|
||
|
||
@pytest.fixture | ||
def init_file(runner: CliRunner, tmp_path: Path) -> Path: | ||
target = tmp_path / "foo_bar.py" | ||
runner.invoke(app, ["init", str(target)]) | ||
|
||
return target | ||
|
||
|
||
def test_title_slide_header_injection(init_file: Path) -> None: | ||
assert "# Foo Bar" in init_file.read_text() | ||
|
||
|
||
def test_can_load_init_file(init_file: Path) -> None: | ||
deck, options = load_deck_and_options(init_file) | ||
|
||
assert deck.name == "Foo Bar" | ||
assert options == Options() |