django-configurations/tests/test_cli.py
Benjamin ABEL 36a7061a61 Add a test for configuration argument
This test do not use mock, and only searches the `configuration` option in
the help messages.
2015-01-27 22:49:58 +01:00

17 lines
676 B
Python

import os
import subprocess
PROJECT_DIR = os.getcwd()
TEST_PROJECT_DIR = os.path.join(PROJECT_DIR, 'test_project')
def test_configuration_argument_in_cli():
"""Verify that's configuration option has been added to managements commands"""
os.chdir(TEST_PROJECT_DIR)
p = subprocess.Popen(['python', 'manage.py', 'test',
'--help'], stdout=subprocess.PIPE)
assert '--configuration' in p.communicate()[0].decode('UTF-8')
p = subprocess.Popen(['python', 'manage.py', 'runserver',
'--help'], stdout=subprocess.PIPE)
assert '--configuration' in p.communicate()[0].decode('UTF-8')
os.chdir(PROJECT_DIR)