mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 15:21:13 +03:00
Merge pull request #2632 from chrismeyersfsu/fix-saml_admin_attr
fix saml_admin_attr
This commit is contained in:
commit
90fba9381d
@ -1213,7 +1213,7 @@ register(
|
||||
category=_('SAML'),
|
||||
category_slug='saml',
|
||||
placeholder=collections.OrderedDict([
|
||||
('saml_attr', 'organization'),
|
||||
('saml_attr', 'team'),
|
||||
('remove', True),
|
||||
('team_org_map', [
|
||||
collections.OrderedDict([
|
||||
|
@ -757,6 +757,8 @@ class SAMLOrgAttrField(BaseDictWithChildField):
|
||||
child_fields = {
|
||||
'remove': fields.BooleanField(required=False),
|
||||
'saml_attr': fields.CharField(required=False, allow_null=True),
|
||||
'remove_admins': fields.BooleanField(required=False),
|
||||
'saml_admin_attr': fields.CharField(required=False, allow_null=True),
|
||||
}
|
||||
|
||||
|
||||
|
@ -20,6 +20,11 @@ class TestSAMLOrgAttrField():
|
||||
({'remove': True, 'saml_attr': 3.14}, {'remove': True, 'saml_attr': '3.14'}),
|
||||
({'saml_attr': 'foobar'}, {'saml_attr': 'foobar'}),
|
||||
({'remove': True}, {'remove': True}),
|
||||
({'remove': True, 'saml_admin_attr': 'foobar'}, {'remove': True, 'saml_admin_attr': 'foobar'}),
|
||||
({'saml_admin_attr': 'foobar'}, {'saml_admin_attr': 'foobar'}),
|
||||
({'remove_admins': True, 'saml_admin_attr': 'foobar'}, {'remove_admins': True, 'saml_admin_attr': 'foobar'}),
|
||||
({'remove': True, 'saml_attr': 'foo', 'remove_admins': True, 'saml_admin_attr': 'bar'},
|
||||
{'remove': True, 'saml_attr': 'foo', 'remove_admins': True, 'saml_admin_attr': 'bar'}),
|
||||
])
|
||||
def test_internal_value_valid(self, data, expected):
|
||||
field = SAMLOrgAttrField()
|
||||
@ -33,6 +38,10 @@ class TestSAMLOrgAttrField():
|
||||
ValidationError('Not a valid string.')),
|
||||
({'remove': True, 'saml_attr': False, 'foo': 'bar', 'gig': 'ity'},
|
||||
ValidationError('Invalid key(s): "gig", "foo".')),
|
||||
({'remove_admins': True, 'saml_admin_attr': False},
|
||||
ValidationError('Not a valid string.')),
|
||||
({'remove_admins': 'blah', 'saml_admin_attr': 'foobar'},
|
||||
ValidationError('"blah" is not a valid boolean.')),
|
||||
])
|
||||
def test_internal_value_invalid(self, data, expected):
|
||||
field = SAMLOrgAttrField()
|
||||
|
Loading…
Reference in New Issue
Block a user