Projet

Général

Profil

0001-hobo-digest-emails-parameters-sent-by-hobo-11309.patch

Frédéric Péters, 12 juin 2016 10:57

Télécharger (2,06 ko)

Voir les différences:

Subject: [PATCH] hobo: digest emails parameters sent by hobo (#11309)

 tests/test_hobo.py     |  4 ++++
 wcs/ctl/check_hobos.py | 11 +++++++++++
 2 files changed, 15 insertions(+)
tests/test_hobo.py
167 167
  },
168 168
  'variables': {
169 169
    'foobar': 'http://example.net',
170
    'email_signature': 'Hello world.',
171
    'default_from_email': 'noreply@example.net',
170 172
  },
171 173
  'users': [
172 174
    {
......
208 210
    service = [x for x in HOBO_JSON.get('services', []) if x.get('service-id') == 'wcs'][0]
209 211
    hobo_cmd.update_configuration(service, pub)
210 212
    assert pub.cfg['misc']['sitename'] == 'Test wcs'
213
    assert pub.cfg['emails']['footer'] == 'Hello world.'
214
    assert pub.cfg['emails']['from'] == 'noreply@example.net'
211 215

  
212 216
def test_update_profile():
213 217
    profile = HOBO_JSON.get('profile')
wcs/ctl/check_hobos.py
135 135
        pub.cfg['misc']['frontoffice-url'] = service.get('base_url').encode('utf-8')
136 136
        if not pub.cfg.get('language'):
137 137
            pub.cfg['language'] = {'language': 'fr'}
138

  
139
        if not pub.cfg.get('emails'):
140
            pub.cfg['emails'] = {}
141

  
142
        variables = self.all_services.get('variables') or {}
143
        variables.update(service.get('variables') or {})
144
        if variables.get('default_from_email'):
145
            pub.cfg['emails']['from'] = variables.get('default_from_email').encode('utf-8')
146
        if variables.get('email_signature') is not None:
147
            pub.cfg['emails']['footer'] = variables.get('email_signature').encode('utf-8')
148

  
138 149
        pub.write_cfg()
139 150

  
140 151
    def update_profile(self, profile, pub):
141
-