authentic agent: include collectivity in secondary service label (#51127)
This commit is contained in:
parent
24e7c657a0
commit
126ad8c85b
|
@ -158,11 +158,15 @@ class Command(hobo_deploy.Command):
|
|||
provider.federation_source = 'hobo'
|
||||
provider.metadata = metadata_text
|
||||
provider.metadata_url = service['saml-sp-metadata-url']
|
||||
if service.get('variables', {}).get('ou-slug'):
|
||||
variables = service.get('variables', {})
|
||||
if variables.get('ou-slug'):
|
||||
ou, created = get_ou_model().objects.get_or_create(
|
||||
slug=service['variables']['ou-slug'])
|
||||
ou.name = service['variables']['ou-label']
|
||||
ou.save()
|
||||
if service.get('secondary') and variables.get('ou-label'):
|
||||
# for secondary services include collectivity in label
|
||||
provider.name = '%s (%s)' % (service['title'], service['variables']['ou-label'])
|
||||
else:
|
||||
# if there are more than one w.c.s. service we will create an
|
||||
# ou of the same name
|
||||
|
|
|
@ -302,9 +302,14 @@ def test_hobo_deploy(monkeypatch, tenant_base, mocker, skeleton_dir, tmp_path):
|
|||
'template_name': 'commune',
|
||||
'slug': 'clapiers',
|
||||
'title': 'Clapiers',
|
||||
'secondary': True,
|
||||
'base_url': 'http://clapiers.example.net',
|
||||
'saml-sp-metadata-url':
|
||||
'http://clapiers.example.net/saml/metadata',
|
||||
'variables': {
|
||||
'ou-label': 'OU label',
|
||||
'ou-slug': 'ou-slug',
|
||||
},
|
||||
},
|
||||
]
|
||||
}
|
||||
|
@ -422,7 +427,10 @@ def test_hobo_deploy(monkeypatch, tenant_base, mocker, skeleton_dir, tmp_path):
|
|||
assert LibertyProvider.objects.filter(slug=service['slug']) \
|
||||
.count() == 1
|
||||
provider = LibertyProvider.objects.get(slug=service['slug'])
|
||||
assert provider.name == service['title']
|
||||
if service['slug'] == 'clapiers':
|
||||
assert provider.name == 'Clapiers (OU label)'
|
||||
else:
|
||||
assert provider.name == service['title']
|
||||
assert provider.federation_source == 'hobo'
|
||||
assert provider.entity_id == service['saml-sp-metadata-url']
|
||||
assert LibertyServiceProvider.objects.filter(
|
||||
|
@ -445,7 +453,8 @@ def test_hobo_deploy(monkeypatch, tenant_base, mocker, skeleton_dir, tmp_path):
|
|||
if i == 0 or service_id != 'wcs':
|
||||
assert provider.ou == get_default_ou()
|
||||
else:
|
||||
assert provider.ou.name == service['title']
|
||||
assert provider.ou.name == \
|
||||
service['variables']['ou-label'] if 'variables' in service else service['title']
|
||||
assert su_role.ou == provider.ou
|
||||
assert provider.attributes.count() == 2
|
||||
assert provider.attributes.filter(
|
||||
|
|
Loading…
Reference in New Issue