forked from orbit-oss/flask
Enhance tests.test_cli.test_find_best_app (#1882)
This commit adds a test case for `test_find_best_app` where Module object does not contain Flask application. Also cleans the function little bit to provides more meaningful comment.
This commit is contained in:
parent
b7a0cc61c5
commit
f19d3bd67e
1 changed files with 14 additions and 11 deletions
|
|
@ -32,24 +32,27 @@ def test_cli_name(test_apps):
|
|||
|
||||
|
||||
def test_find_best_app(test_apps):
|
||||
"""Test of find_best_app."""
|
||||
class mod:
|
||||
"""Test if `find_best_app` behaves as expected with different combinations of input."""
|
||||
class Module:
|
||||
app = Flask('appname')
|
||||
assert find_best_app(mod) == mod.app
|
||||
assert find_best_app(Module) == Module.app
|
||||
|
||||
class mod:
|
||||
class Module:
|
||||
application = Flask('appname')
|
||||
assert find_best_app(mod) == mod.application
|
||||
assert find_best_app(Module) == Module.application
|
||||
|
||||
class mod:
|
||||
class Module:
|
||||
myapp = Flask('appname')
|
||||
assert find_best_app(mod) == mod.myapp
|
||||
assert find_best_app(Module) == Module.myapp
|
||||
|
||||
class mod:
|
||||
myapp = Flask('appname')
|
||||
class Module:
|
||||
pass
|
||||
pytest.raises(NoAppException, find_best_app, Module)
|
||||
|
||||
class Module:
|
||||
myapp1 = Flask('appname1')
|
||||
myapp2 = Flask('appname2')
|
||||
|
||||
pytest.raises(NoAppException, find_best_app, mod)
|
||||
pytest.raises(NoAppException, find_best_app, Module)
|
||||
|
||||
|
||||
def test_prepare_exec_for_file(test_apps):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue