mirror of
https://github.com/ansible/awx.git
synced 2026-03-14 07:27:28 -02:30
Support AWX_TASK_ENV injection in task and notification invocations.
This change _only_ injects `AWS_TASK_ENV` into `os.environ`; it's up to underlying libraries to be good citizens and actually respect things like `HTTPS_PROXY`. see: #3508
This commit is contained in:
@@ -2,7 +2,9 @@
|
||||
|
||||
# Copyright (c) 2017 Ansible, Inc.
|
||||
# All Rights Reserved.
|
||||
import os
|
||||
import pytest
|
||||
from uuid import uuid4
|
||||
|
||||
from awx.main.utils import common
|
||||
|
||||
@@ -15,3 +17,13 @@ from awx.main.utils import common
|
||||
])
|
||||
def test_parse_yaml_or_json(input_, output):
|
||||
assert common.parse_yaml_or_json(input_) == output
|
||||
|
||||
|
||||
def test_set_environ():
|
||||
key = str(uuid4())
|
||||
old_environ = os.environ.copy()
|
||||
with common.set_environ(**{key: 'bar'}):
|
||||
assert os.environ[key] == 'bar'
|
||||
assert set(os.environ.keys()) - set(old_environ.keys()) == set([key])
|
||||
assert os.environ == old_environ
|
||||
assert key not in os.environ
|
||||
|
||||
Reference in New Issue
Block a user