Files
notifications-admin/tests/app/test_cloudfoundry_config.py
Leo Hemsted 91adadfed0 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
2020-01-07 12:03:30 +00:00

18 lines
457 B
Python

import os
import pytest
from app.cloudfoundry_config import extract_cloudfoundry_config
@pytest.fixture
def cloudfoundry_environ(os_environ):
os.environ['VCAP_APPLICATION'] = '{"space_name":"🚀🌌"}'
def test_extract_cloudfoundry_config_populates_other_vars(cloudfoundry_environ):
extract_cloudfoundry_config()
assert os.environ['NOTIFY_ENVIRONMENT'] == '🚀🌌'
assert os.environ['NOTIFY_LOG_PATH'] == '/home/vcap/logs/app.log'