mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-16 20:49:00 -04:00
dont reassign os.environ
os.environ is an `environ` object, not a dict. by only interacting with it through builtin functions we can ensure it remains properly accessible to third party libraries which might interact with it in different ways. See https://github.com/alphagov/notifications-api/commit/d2441466 for more detail
This commit is contained in:
@@ -6,12 +6,11 @@ from app.cloudfoundry_config import extract_cloudfoundry_config
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def cloudfoundry_environ(monkeypatch):
|
||||
monkeypatch.setenv('VCAP_APPLICATION', '{"space_name":"🚀🌌"}')
|
||||
def cloudfoundry_environ(os_environ):
|
||||
os.environ['VCAP_APPLICATION'] = '{"space_name":"🚀🌌"}'
|
||||
|
||||
|
||||
@pytest.mark.usefixtures('os_environ', 'cloudfoundry_environ')
|
||||
def test_extract_cloudfoundry_config_populates_other_vars():
|
||||
def test_extract_cloudfoundry_config_populates_other_vars(cloudfoundry_environ):
|
||||
extract_cloudfoundry_config()
|
||||
|
||||
assert os.environ['NOTIFY_ENVIRONMENT'] == '🚀🌌'
|
||||
|
||||
Reference in New Issue
Block a user