Projet

Général

Profil

0001-hobo-add-idp_account_url-variable-13811.patch

Frédéric Péters, 31 octobre 2016 16:23

Télécharger (4,63 ko)

Voir les différences:

Subject: [PATCH] hobo: add idp_account_url variable (#13811)

 tests/test_hobo.py     | 17 +++++++++--------
 wcs/ctl/check_hobos.py |  2 ++
 2 files changed, 11 insertions(+), 8 deletions(-)
tests/test_hobo.py
33 33
      'template_name': '',
34 34
      'variables': {},
35 35
      'title': 'Authentic',
36
      'base_url': 'http://authentic.example.net',
36
      'base_url': 'http://authentic.example.net/',
37 37
      'id': 3,
38 38
      'secret_key': '_b82$d)(xcw$dl@ieis@jhmrmbbeb4$=%lrpi*4p&b))*a*=5!',
39 39
      'slug': 'authentic',
......
45 45
      'variables': {'xxx': 'HELLO WORLD'},
46 46
      'title': 'Test wcs',
47 47
      'saml-sp-metadata-url': 'http://wcs.example.net/saml/metadata',
48
      'base_url': 'http://wcs.example.net',
48
      'base_url': 'http://wcs.example.net/',
49 49
      'backoffice-menu-url': 'http://wcs.example.net/backoffice/menu.json',
50 50
      'id': 1,
51 51
      'secret_key': 'eiue7aa10nt6e9*#jg2bsfvdgl)cr%4(tafibfjx9i$pgnfj#v',
......
55 55
      'service-id': 'combo',
56 56
      'template_name': 'portal-agent',
57 57
      'title': 'Portal Agents',
58
      'base_url': 'http://agents.example.net',
58
      'base_url': 'http://agents.example.net/',
59 59
      'secret_key': 'aaa',
60 60
    },
61 61
    {
62 62
      'service-id': 'combo',
63 63
      'template_name': 'portal-user',
64 64
      'title': 'Portal',
65
      'base_url': 'http://portal.example.net',
65
      'base_url': 'http://portal.example.net/',
66 66
      'secret_key': 'bbb',
67 67
    },
68 68
  ],
......
227 227
    assert pub.get_site_option('hobo_url', 'variables') == 'http://hobo.example.net/'
228 228
    assert pub.get_site_option('foobar', 'variables') == 'http://example.net'
229 229
    assert pub.get_site_option('xxx', 'variables') == 'HELLO WORLD'
230
    assert pub.get_site_option('portal_agent_url', 'variables') == 'http://agents.example.net'
231
    assert pub.get_site_option('portal_url', 'variables') == 'http://portal.example.net'
230
    assert pub.get_site_option('portal_agent_url', 'variables') == 'http://agents.example.net/'
231
    assert pub.get_site_option('portal_url', 'variables') == 'http://portal.example.net/'
232 232
    assert (pub.get_site_option('authentic.example.net', 'api-secrets')
233 233
            == CmdCheckHobos.shared_secret(HOBO_JSON['services'][1]['secret_key'],
234 234
                                           HOBO_JSON['services'][2]['secret_key']))
......
324 324
    assert pub.cfg['saml_identities']['registration-url']
325 325
    assert pub.cfg['sp']['idp-manage-user-attributes']
326 326
    assert pub.cfg['sp']['idp-manage-roles']
327
    assert pub.get_site_option('idp_account_url', 'variables').endswith('/accounts/')
327 328

  
328 329
def test_deploy():
329 330
    cleanup()
......
340 341
    sub_options = sub_options_class(True, False, None)
341 342
    sys.modules['publisher'] = sys.modules['wcs.publisher']
342 343
    hobo_cmd.execute(base_options, sub_options,
343
            ['http://wcs.example.net', os.path.join(alt_tempdir, 'hobo.json')])
344
            ['http://wcs.example.net/', os.path.join(alt_tempdir, 'hobo.json')])
344 345
    assert os.path.exists(os.path.join(alt_tempdir, 'wcs.example.net'))
345 346

  
346 347
    # update
......
351 352
    cPickle.dump(pub_cfg,
352 353
            open(os.path.join(alt_tempdir, 'wcs.example.net', 'config.pck'), 'w'))
353 354
    hobo_cmd.execute(base_options, sub_options,
354
            ['http://wcs.example.net', os.path.join(alt_tempdir, 'hobo.json')])
355
            ['http://wcs.example.net/', os.path.join(alt_tempdir, 'hobo.json')])
355 356
    pub_cfg = cPickle.load(open(os.path.join(alt_tempdir, 'wcs.example.net', 'config.pck')))
356 357
    assert pub_cfg['language'] == {'language': 'fr'}
wcs/ctl/check_hobos.py
319 319
                    variables['portal_url'] = service.get('base_url')
320 320
                    config.set('options', 'theme_skeleton_url',
321 321
                            service.get('base_url') + '__skeleton__/')
322
            if service.get('service-id') == 'authentic':
323
                variables['idp_account_url'] = service.get('base_url') + 'accounts/'
322 324
        if self.all_services.get('variables'):
323 325
            for key, value in self.all_services.get('variables').items():
324 326
                variables[key] = value
325
-