Add cloudfoundry config values

also added tests
This commit is contained in:
Leo Hemsted
2017-04-10 18:12:00 +01:00
parent a6318f2674
commit 9391181b2c
10 changed files with 113 additions and 60 deletions

View File

@@ -8,15 +8,14 @@ class TemplatePreview:
@classmethod
def from_database_object(cls, template, filetype, values=None):
data = {
"letter_contact_block": current_service['letter_contact_block'],
"admin_base_url": current_app.config['ADMIN_BASE_URL'],
"template": template,
"values": values
'letter_contact_block': current_service['letter_contact_block'],
'template': template,
'values': values
}
resp = requests.post(
'{}/preview.{}'.format(current_app.config['TEMPLATE_PREVIEW_SERVICE_URL'], filetype),
'{}/preview.{}'.format(current_app.config['TEMPLATE_PREVIEW_API_HOST'], filetype),
json=data,
headers={'Authorization': 'Token my-secret-key'}
headers={'Authorization': 'Token {}'.format(current_app.config['TEMPLATE_PREVIEW_API_KEY'])}
)
return (resp.content, resp.status_code, resp.headers.items())