Skip to content

Commit d598785

Browse files
committed
tests for coverage
1 parent c074957 commit d598785

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

django_typer/tests/apps/test_app/management/commands/completion.py

+15
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,21 @@ def handle(
9393
),
9494
),
9595
] = [],
96+
app_opt: Annotated[
97+
t.List[str],
98+
typer.Option(
99+
help=_("One or more application labels."),
100+
shell_complete=completers.complete_app_label,
101+
),
102+
] = ["test_app"],
103+
databases: Annotated[
104+
t.List[str],
105+
typer.Option(
106+
"--db",
107+
help=_("One or more database aliases."),
108+
shell_complete=completers.databases(),
109+
),
110+
] = [],
96111
):
97112
assert self.__class__ is Command
98113
for app in django_apps:

django_typer/tests/test_parser_completers.py

+14
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,13 @@ def test_app_label_parser_completers(self):
122122
self.assertTrue("messages" in result)
123123
self.assertTrue("staticfiles" in result)
124124

125+
result = StringIO()
126+
with contextlib.redirect_stdout(result):
127+
call_command("shellcompletion", "complete", "completion --app-opt ")
128+
result = result.getvalue()
129+
self.assertTrue("test_app" in result)
130+
self.assertTrue("django_typer_tests_apps_util" in result)
131+
125132
result = StringIO()
126133
with contextlib.redirect_stdout(result):
127134
call_command(
@@ -1380,3 +1387,10 @@ def test_chain_and_commands_completer(self):
13801387
self.assertFalse("dj_params2" in result)
13811388
self.assertFalse("dj_params3" in result)
13821389
self.assertFalse("dj_params4" in result)
1390+
1391+
def test_databases_completer(self):
1392+
result = run_command("shellcompletion", "complete", "completion --db ")[
1393+
0
1394+
].strip()
1395+
1396+
self.assertTrue("default" in result)

doc/source/changelog.rst

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
Change Log
33
==========
44

5+
v2.0.1
6+
======
7+
8+
* Fixed `Readme images are broken. <https://github.com/bckohan/django-typer/issues/77>`_
9+
510
v2.0.0
611
======
712

0 commit comments

Comments
 (0)