File tree Expand file tree Collapse file tree 11 files changed +71
-5
lines changed
Expand file tree Collapse file tree 11 files changed +71
-5
lines changed Original file line number Diff line number Diff line change 66from pythonanywhere .snakesay import snakesay
77from pythonanywhere .utils import ensure_domain
88
9- app = typer .Typer ()
9+ app = typer .Typer (no_args_is_help = True )
1010
1111
1212@app .command ()
Original file line number Diff line number Diff line change 99from pythonanywhere .files import PAPath
1010from pythonanywhere .scripts_commons import get_logger
1111
12- app = typer .Typer ()
12+ app = typer .Typer (no_args_is_help = True )
1313
1414
1515def setup (path : str , quiet : bool ) -> PAPath :
Original file line number Diff line number Diff line change 1010from pythonanywhere .snakesay import snakesay
1111from pythonanywhere .task import Task , TaskList
1212
13- app = typer .Typer ()
13+ app = typer .Typer (no_args_is_help = True )
1414
1515
1616@app .command ()
Original file line number Diff line number Diff line change 55from pythonanywhere .scripts_commons import get_logger
66from pythonanywhere .students import Students
77
8- app = typer .Typer ()
8+ app = typer .Typer (no_args_is_help = True )
99
1010
1111def setup (quiet : bool ) -> Students :
Original file line number Diff line number Diff line change 1010from pythonanywhere .snakesay import snakesay
1111from pythonanywhere .utils import ensure_domain
1212
13- app = typer .Typer ()
13+ app = typer .Typer (no_args_is_help = True )
1414
1515
1616@app .command ()
Original file line number Diff line number Diff line change @@ -33,6 +33,15 @@ def running_python_version():
3333 return "." .join (python_version ().split ("." )[:2 ])
3434
3535
36+ def test_main_subcommand_without_args_prints_help ():
37+ result = runner .invoke (
38+ app ,
39+ [],
40+ )
41+ assert result .exit_code == 0
42+ assert "Show this message and exit." in result .stdout
43+
44+
3645def test_autoconfigure_calls_all_stuff_in_right_order (mock_django_project ):
3746 result = runner .invoke (
3847 app ,
Original file line number Diff line number Diff line change 1+ from typer .testing import CliRunner
2+
3+ from cli .pa import app
4+
5+ runner = CliRunner ()
6+
7+
8+ def test_main_command_without_args_prints_help ():
9+ result = runner .invoke (
10+ app ,
11+ [],
12+ )
13+ assert result .exit_code == 0
14+ assert "This is a new experimental PythonAnywhere cli client." in result .stdout
15+ assert "Makes Django Girls tutorial projects deployment easy" in result .stdout
16+ assert "Perform some operations on files" in result .stdout
17+ assert "Manage scheduled tasks" in result .stdout
18+ assert "Perform some operations on students" in result .stdout
19+ assert "Everything for web apps" in result .stdout
20+
21+
Original file line number Diff line number Diff line change @@ -41,6 +41,15 @@ def mock_file_path(mock_path):
4141 return mock_path
4242
4343
44+ def test_main_subcommand_without_args_prints_help ():
45+ result = runner .invoke (
46+ app ,
47+ [],
48+ )
49+ assert result .exit_code == 0
50+ assert "Show this message and exit." in result .stdout
51+
52+
4453class TestGet :
4554 def test_exits_early_when_no_contents_for_given_path (self , mock_path ):
4655 mock_path .return_value .contents = None
Original file line number Diff line number Diff line change @@ -40,6 +40,15 @@ def mock_confirm(mocker):
4040 return mocker .patch ("cli.schedule.typer.confirm" )
4141
4242
43+ def test_main_subcommand_without_args_prints_help ():
44+ result = runner .invoke (
45+ app ,
46+ [],
47+ )
48+ assert result .exit_code == 0
49+ assert "Show this message and exit." in result .stdout
50+
51+
4352class TestSet :
4453 def test_calls_all_stuff_in_right_order (self , mocker ):
4554 mock_logger = mocker .patch ("cli.schedule.get_logger" )
Original file line number Diff line number Diff line change @@ -22,6 +22,15 @@ def mock_students_delete(mock_students):
2222 return mock_students .return_value .delete
2323
2424
25+ def test_main_subcommand_without_args_prints_help ():
26+ result = runner .invoke (
27+ app ,
28+ [],
29+ )
30+ assert result .exit_code == 0
31+ assert "Show this message and exit." in result .stdout
32+
33+
2534@pytest .mark .students
2635class TestGet :
2736 def test_exits_early_with_error_when_api_does_not_return_expected_list (
You can’t perform that action at this time.
0 commit comments