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

This commit is contained in:
Valentin Deniaud 2020-11-02 15:31:31 +01:00 committed by Frédéric Péters
parent c57507d9a4
commit 7a33cb6534
2 changed files with 13 additions and 0 deletions

View File

@ -200,6 +200,8 @@ HOBO_JSON = {
'email_signature': 'Hello world.',
'default_from_email': 'noreply@example.net',
'theme': 'clapotis-les-canards',
'sms_url': 'http://passerelle.example.net',
'sms_sender': 'EO',
},
'users': [
{
@ -251,6 +253,9 @@ def test_update_configuration():
assert pub.cfg['misc']['sitename'] == 'Test wcs'
assert pub.cfg['emails']['footer'] == 'Hello world.'
assert pub.cfg['emails']['from'] == 'noreply@example.net'
assert pub.cfg['sms']['passerelle_url'] == 'http://passerelle.example.net'
assert pub.cfg['sms']['mode'] == 'passerelle'
assert pub.cfg['sms']['sender'] == 'EO'
def test_update_themes():

View File

@ -161,6 +161,8 @@ class CmdCheckHobos(Command):
if not pub.cfg.get('emails'):
pub.cfg['emails'] = {}
if not pub.cfg.get('sms'):
pub.cfg['sms'] = {}
variables = self.all_services.get('variables') or {}
variables.update(service.get('variables') or {})
@ -214,6 +216,12 @@ class CmdCheckHobos(Command):
if variables.get('email_signature') is not None:
pub.cfg['emails']['footer'] = force_str(variables.get('email_signature'))
if variables.get('sms_url'):
pub.cfg['sms']['passerelle_url'] = force_str(variables.get('sms_url'))
pub.cfg['sms']['mode'] = 'passerelle'
if variables.get('sms_sender'):
pub.cfg['sms']['sender'] = force_str(variables.get('sms_sender'))
pub.write_cfg()
def update_profile(self, profile, pub):