Files
notifications-api/tests/app/test_cloudfoundry_config.py

32 lines
716 B
Python
Raw Normal View History

2016-12-08 12:12:45 +00:00
import json
2021-03-10 13:55:06 +00:00
import os
2016-12-08 12:12:45 +00:00
import pytest
from app.cloudfoundry_config import extract_cloudfoundry_config
2016-12-08 12:12:45 +00:00
@pytest.fixture
def vcap_services():
return {
'postgres': [{
2016-12-08 12:12:45 +00:00
'credentials': {
'uri': 'postgres uri'
}
}],
'redis': [{
'credentials': {
'uri': 'redis uri'
}
}],
'user-provided': []
2016-12-08 12:12:45 +00:00
}
def test_extract_cloudfoundry_config_populates_other_vars(os_environ, vcap_services):
os.environ['VCAP_SERVICES'] = json.dumps(vcap_services)
2016-12-08 12:12:45 +00:00
extract_cloudfoundry_config()
assert os.environ['SQLALCHEMY_DATABASE_URI'] == 'postgresql uri'
assert os.environ['REDIS_URL'] == 'redis uri'