Skip to content

Commit 39b25e9

Browse files
committed
add tests for coverage
1 parent c95d13c commit 39b25e9

File tree

7 files changed

+39
-7
lines changed

7 files changed

+39
-7
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ ruff = "^0.9"
7373
django-stubs = ">=5.0.2"
7474
mypy = ">=1.10.0"
7575
pre-commit = "^4.0.1"
76+
django-render-static = "^3.2.1"
7677

7778

7879
[tool.poetry.group.docs]

tests/settings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
# Application definition
3030

3131
INSTALLED_APPS = [
32+
"render_static",
3233
"tests.django_routines_tests",
3334
"django_routines",
3435
"django_typer",
@@ -72,7 +73,7 @@
7273
RoutineCommand(("makemigrations",), switches=["prepare"]),
7374
RoutineCommand(("migrate",)),
7475
RoutineCommand(("renderstatic",)),
75-
RoutineCommand(("collectstatic",)),
76+
RoutineCommand("collectstatic", options={"interactive": False}),
7677
prepare=_("Prepare the deployment."),
7778
demo="Deploy the demo.",
7879
)

tests/test_core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -782,9 +782,9 @@ def test_settings_format(self):
782782
"switches": (),
783783
},
784784
{
785-
"command": ("collectstatic",),
785+
"command": "collectstatic",
786786
"kind": "management",
787-
"options": {},
787+
"options": {"interactive": False},
788788
"priority": 0,
789789
"switches": (),
790790
},

tests/test_dataclasses.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
RoutineCommand(command=("makemigrations",), switches=["prepare"]),
2626
RoutineCommand(command=("migrate",)),
2727
RoutineCommand(command=("renderstatic",)),
28-
RoutineCommand(command=("collectstatic",)),
28+
RoutineCommand(command="collectstatic", options={"interactive": False}),
2929
RoutineCommand(
3030
command=("shellcompletion", "install"), switches=("import",)
3131
),
@@ -145,7 +145,9 @@ def test_settings_format(self):
145145
RoutineCommand(command=("makemigrations",), switches=["prepare"]),
146146
RoutineCommand(command=("migrate",)),
147147
RoutineCommand(command=("renderstatic",)),
148-
RoutineCommand(command=("collectstatic",)),
148+
RoutineCommand(
149+
command="collectstatic", options={"interactive": False}
150+
),
149151
RoutineCommand(
150152
command=("shellcompletion", "install"),
151153
switches=("import",),

tests/test_deploy.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
Miscellaneous tests - mostly for coverage
3+
"""
4+
5+
from io import StringIO
6+
from django.core.management import call_command
7+
from django.test import TestCase
8+
9+
10+
class TestDeploy(TestCase):
11+
def test_deploy_routine(self):
12+
out = StringIO()
13+
err = StringIO()
14+
call_command("routine", "deploy", stdout=out, stderr=err)
15+
self.assertTrue(out.getvalue())
16+
self.assertFalse(err.getvalue().strip())

tests/test_dict.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
{"command": ("makemigrations",), "switches": ["prepare"]},
2626
{"command": ("migrate",)},
2727
{"command": ("renderstatic",)},
28-
{"command": ("collectstatic",)},
28+
{"command": "collectstatic", "options": {"interactive": False}},
2929
{"command": ("shellcompletion", "install"), "switches": ("import",)},
3030
{
3131
"command": ("loaddata", "./fixtures/initial_data.json"),
@@ -220,7 +220,7 @@ def test_settings_format(self):
220220
{"command": ("makemigrations",), "switches": ["prepare"]},
221221
{"command": ("migrate",)},
222222
{"command": ("renderstatic",)},
223-
{"command": ("collectstatic",)},
223+
{"command": "collectstatic", "options": {"interactive": False}},
224224
{
225225
"command": ("shellcompletion", "install"),
226226
"switches": ("import",),

tests/test_misc.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
"""
2+
Miscellaneous tests - mostly for coverage
3+
"""
4+
5+
from django_routines import ManagementCommand, SystemCommand
6+
7+
8+
def test_to_dict_return():
9+
assert isinstance(
10+
ManagementCommand.from_dict(ManagementCommand("test")), ManagementCommand
11+
)
12+
assert isinstance(SystemCommand.from_dict(SystemCommand("test")), SystemCommand)

0 commit comments

Comments
 (0)