Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
yakky committed Dec 27, 2020
1 parent 30f6932 commit c9a26aa
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os
import sys
from subprocess import CalledProcessError
from unittest.mock import call, patch

Expand All @@ -20,6 +22,16 @@ def test_cli_install_wrong_dir(blog_package):
assert install_fun.call_args_list == [call("djangocms-blog", verbose=True, pip_options="")]


def test_cli_sys_path(project_dir, blog_package):
"""Running install command from the wrong directory raise an error."""
with patch("app_enabler.cli.enable_fun"):
# not using working_directory context manager to skip setting the sys.path (which is what we want to test)
os.chdir(str(project_dir))
runner = CliRunner()
runner.invoke(cli, ["enable", "djangocms-blog"])
assert str(project_dir) == sys.path[0]


def test_cli_install(project_dir, blog_package):
"""Running install command calls the business functions with the correct arguments."""
with patch("app_enabler.cli.enable_fun") as enable_fun, patch(
Expand Down

0 comments on commit c9a26aa

Please sign in to comment.