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
cab09be
commit e571370
Showing
5 changed files
with
53 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# -*- coding: utf-8 -*- |
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,35 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import pytest | ||
|
||
from ckan.cli.cli import ckan | ||
|
||
|
||
def test_ckan_without_args(cli): | ||
"""Show help by default. | ||
""" | ||
result = cli.invoke(ckan) | ||
assert result.output.startswith(u'Usage: ckan') | ||
assert not result.exit_code | ||
|
||
|
||
def test_ckan_incorrect_config(cli): | ||
"""Config file must exist. | ||
""" | ||
result = cli.invoke(ckan, [u'-c', u'/a/b/c/d/e/f/g/h.ini']) | ||
assert result.output.startswith(u'Config file not found') | ||
|
||
|
||
def test_ckan_correct_config(cli, ckan_config): | ||
"""Presense of config file disables default printing of help message. | ||
""" | ||
result = cli.invoke(ckan, [u'-c', ckan_config[u'__file__']]) | ||
assert u'Error: Missing command.' in result.output | ||
assert result.exit_code | ||
|
||
|
||
def test_ckan_correct_config_with_help(cli, ckan_config): | ||
"""Config file not ignored when displaying usage. | ||
""" | ||
result = cli.invoke(ckan, [u'-c', ckan_config[u'__file__'], u'-h']) | ||
assert not result.exit_code |
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