hobo: digest emails parameters sent by hobo (#11309)

This commit is contained in:
Frédéric Péters 2016-06-11 20:37:26 +02:00
parent 318cc4f0e4
commit 8e74af8635
2 changed files with 15 additions and 0 deletions

View File

@ -167,6 +167,8 @@ HOBO_JSON = {
},
'variables': {
'foobar': 'http://example.net',
'email_signature': 'Hello world.',
'default_from_email': 'noreply@example.net',
},
'users': [
{
@ -208,6 +210,8 @@ def test_update_configuration():
service = [x for x in HOBO_JSON.get('services', []) if x.get('service-id') == 'wcs'][0]
hobo_cmd.update_configuration(service, pub)
assert pub.cfg['misc']['sitename'] == 'Test wcs'
assert pub.cfg['emails']['footer'] == 'Hello world.'
assert pub.cfg['emails']['from'] == 'noreply@example.net'
def test_update_profile():
profile = HOBO_JSON.get('profile')

View File

@ -135,6 +135,17 @@ class CmdCheckHobos(Command):
pub.cfg['misc']['frontoffice-url'] = service.get('base_url').encode('utf-8')
if not pub.cfg.get('language'):
pub.cfg['language'] = {'language': 'fr'}
if not pub.cfg.get('emails'):
pub.cfg['emails'] = {}
variables = self.all_services.get('variables') or {}
variables.update(service.get('variables') or {})
if variables.get('default_from_email'):
pub.cfg['emails']['from'] = variables.get('default_from_email').encode('utf-8')
if variables.get('email_signature') is not None:
pub.cfg['emails']['footer'] = variables.get('email_signature').encode('utf-8')
pub.write_cfg()
def update_profile(self, profile, pub):