Added optional passing of one or multiple environment variables via --env flag to the bonobo cli.
This commit is contained in:
@ -3,6 +3,7 @@ import runpy
|
||||
import sys
|
||||
from unittest.mock import patch
|
||||
|
||||
import pathlib
|
||||
import pkg_resources
|
||||
import pytest
|
||||
|
||||
@ -96,3 +97,29 @@ def test_version(runner, capsys):
|
||||
out = out.strip()
|
||||
assert out.startswith('bonobo ')
|
||||
assert __version__ in out
|
||||
|
||||
|
||||
@all_runners
|
||||
def test_run_with_env(runner, capsys):
|
||||
runner('run', '--quiet',
|
||||
str(pathlib.Path(os.path.dirname(__file__),
|
||||
'util', 'get_passed_env.py')),
|
||||
'--env', 'ENV_TEST_NUMBER=123', '--env', 'ENV_TEST_USER=cwandrews',
|
||||
'--env', "ENV_TEST_STRING='my_test_string'")
|
||||
out, err = capsys.readouterr()
|
||||
out = out.split('\n')
|
||||
assert out[0] == 'cwandrews'
|
||||
assert out[1] == '123'
|
||||
assert out[2] == 'my_test_string'
|
||||
|
||||
|
||||
@all_runners
|
||||
def test_run_module_with_env(runner, capsys):
|
||||
runner('run', '--quiet', '-m', 'tests.util.get_passed_env',
|
||||
'--env', 'ENV_TEST_NUMBER=123', '--env', 'ENV_TEST_USER=cwandrews',
|
||||
'--env', "ENV_TEST_STRING='my_test_string'")
|
||||
out, err = capsys.readouterr()
|
||||
out = out.split('\n')
|
||||
assert out[0] == 'cwandrews'
|
||||
assert out[1] == '123'
|
||||
assert out[2] == 'my_test_string'
|
||||
|
||||
Reference in New Issue
Block a user