add new performance-platform section to cf config

it's a new cf-service we've got to create, that contains endpoints
and the bearer tokens for them.
This commit is contained in:
Leo Hemsted
2017-08-23 18:11:44 +01:00
parent 89f4f5173e
commit bd2682b521
4 changed files with 35 additions and 20 deletions

View File

@@ -270,12 +270,7 @@ def test_will_remove_csv_files_for_jobs_older_than_seven_days(
]
def test_send_daily_performance_stats_calls_does_not_send_if_inactive(
notify_db,
notify_db_session,
sample_template,
mocker
):
def test_send_daily_performance_stats_calls_does_not_send_if_inactive(mocker):
send_mock = mocker.patch('app.celery.scheduled_tasks.total_sent_notifications.send_total_notifications_sent_for_day_stats')
with patch.object(

View File

@@ -16,7 +16,6 @@ def notify_config():
'admin_client_secret': 'admin client secret',
'secret_key': 'secret key',
'dangerous_salt': 'dangerous salt',
'performance_platform_token': 'performance platform token',
'allow_ip_inbound_sms': ['111.111.111.111', '100.100.100.100']
}
}
@@ -87,6 +86,16 @@ def redis_config():
}
}
@pytest.fixture
def performance_platform_config():
return {
'name': 'performance-platform',
'credentials': {
'foo': 'my_token',
'bar': 'other_token'
}
}
@pytest.fixture
def cloudfoundry_config(
@@ -96,7 +105,8 @@ def cloudfoundry_config(
hosted_graphite_config,
mmg_config,
firetext_config,
redis_config
redis_config,
performance_platform_config
):
return {
'postgres': postgres_config,
@@ -106,7 +116,8 @@ def cloudfoundry_config(
hosted_graphite_config,
mmg_config,
firetext_config,
redis_config
redis_config,
performance_platform_config
]
}
@@ -148,16 +159,6 @@ def test_notify_config():
assert os.environ['ADMIN_CLIENT_SECRET'] == 'admin client secret'
assert os.environ['SECRET_KEY'] == 'secret key'
assert os.environ['DANGEROUS_SALT'] == 'dangerous salt'
assert os.environ['PERFORMANCE_PLATFORM_TOKEN'] == 'performance platform token'
@pytest.mark.usefixtures('os_environ', 'cloudfoundry_environ')
def test_notify_config_if_perf_platform_not_set(cloudfoundry_config):
del cloudfoundry_config['user-provided'][0]['credentials']['performance_platform_token']
set_config_env_vars(cloudfoundry_config)
assert os.environ['PERFORMANCE_PLATFORM_TOKEN'] == ''
@pytest.mark.usefixtures('os_environ', 'cloudfoundry_environ')
@@ -205,3 +206,13 @@ def test_sms_inbound_config():
extract_cloudfoundry_config()
assert os.environ['SMS_INBOUND_WHITELIST'] == json.dumps(['111.111.111.111', '100.100.100.100'])
@pytest.mark.usefixtures('os_environ', 'cloudfoundry_environ')
def test_performance_platform_config():
extract_cloudfoundry_config()
assert os.environ['PERFORMANCE_PLATFORM_ENDPOINTS'] == json.dumps({
'foo': 'my_token',
'bar': 'other_token'
})