mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-05 08:31:00 -04:00
Use VCAP_APPLICATION to detect CloudFoundry environment
VCAP_SERVICES is not set on PaaS if no services are bound to the application, so we need to check for VCAP_APPLICATION to parse the application name and environment.
This commit is contained in:
@@ -26,7 +26,7 @@ def reload_config():
|
||||
|
||||
def test_load_cloudfoundry_config_if_available(monkeypatch, reload_config):
|
||||
os.environ['API_HOST_NAME'] = 'env'
|
||||
monkeypatch.setenv('VCAP_SERVICES', 'some json blob')
|
||||
monkeypatch.setenv('VCAP_APPLICATION', 'some json blob')
|
||||
|
||||
with mock.patch('app.cloudfoundry_config.extract_cloudfoundry_config', side_effect=cf_conf) as cf_config:
|
||||
# reload config so that its module level code (ie: all of it) is re-instantiated
|
||||
@@ -41,7 +41,7 @@ def test_load_cloudfoundry_config_if_available(monkeypatch, reload_config):
|
||||
def test_load_config_if_cloudfoundry_not_available(monkeypatch, reload_config):
|
||||
os.environ['API_HOST_NAME'] = 'env'
|
||||
|
||||
monkeypatch.delenv('VCAP_SERVICES', raising=False)
|
||||
monkeypatch.delenv('VCAP_APPLICATION', raising=False)
|
||||
|
||||
with mock.patch('app.cloudfoundry_config.extract_cloudfoundry_config') as cf_config:
|
||||
# reload config so that its module level code (ie: all of it) is re-instantiated
|
||||
|
||||
Reference in New Issue
Block a user