-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add tests for deploy and cli commands
- Loading branch information
Showing
5 changed files
with
374 additions
and
26 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,42 @@ | ||
import os | ||
|
||
from click.testing import CliRunner | ||
from writer.command_line import main | ||
|
||
|
||
def test_version(): | ||
runner = CliRunner() | ||
with runner.isolated_filesystem(): | ||
result = runner.invoke(main, ['-v']) | ||
assert result.exit_code == 0 | ||
assert 'version' in result.output | ||
|
||
def test_create_default(): | ||
runner = CliRunner() | ||
with runner.isolated_filesystem(): | ||
result = runner.invoke(main, ['create', './my_app']) | ||
print(result.output) | ||
assert result.exit_code == 0 | ||
#check if filder exists and if has the right files | ||
assert os.path.exists('./my_app') | ||
assert os.path.exists('./my_app/ui.json') | ||
assert os.path.exists('./my_app/main.py') | ||
#load toml and check name and version | ||
with open('./my_app/pyproject.toml') as f: | ||
content = f.read() | ||
assert content.find('name = "writer-framework-default"') != -1 | ||
|
||
def test_create_specific_template(): | ||
runner = CliRunner() | ||
with runner.isolated_filesystem(): | ||
result = runner.invoke(main, ['create', './my_app', '--template', 'hello']) | ||
print(result.output) | ||
assert result.exit_code == 0 | ||
#check if filder exists and if has the right files | ||
assert os.path.exists('./my_app') | ||
assert os.path.exists('./my_app/ui.json') | ||
assert os.path.exists('./my_app/main.py') | ||
#load toml and check name and version | ||
with open('./my_app/pyproject.toml') as f: | ||
content = f.read() | ||
assert content.find('name = "writer-framework-hello"') != -1 |
Oops, something went wrong.