mirror of
https://github.com/ansible/awx.git
synced 2026-02-21 13:10:11 -03:30
fix saml_admin_attr
This commit is contained in:
@@ -1213,7 +1213,7 @@ register(
|
|||||||
category=_('SAML'),
|
category=_('SAML'),
|
||||||
category_slug='saml',
|
category_slug='saml',
|
||||||
placeholder=collections.OrderedDict([
|
placeholder=collections.OrderedDict([
|
||||||
('saml_attr', 'organization'),
|
('saml_attr', 'team'),
|
||||||
('remove', True),
|
('remove', True),
|
||||||
('team_org_map', [
|
('team_org_map', [
|
||||||
collections.OrderedDict([
|
collections.OrderedDict([
|
||||||
|
|||||||
@@ -757,6 +757,8 @@ class SAMLOrgAttrField(BaseDictWithChildField):
|
|||||||
child_fields = {
|
child_fields = {
|
||||||
'remove': fields.BooleanField(required=False),
|
'remove': fields.BooleanField(required=False),
|
||||||
'saml_attr': fields.CharField(required=False, allow_null=True),
|
'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'}),
|
({'remove': True, 'saml_attr': 3.14}, {'remove': True, 'saml_attr': '3.14'}),
|
||||||
({'saml_attr': 'foobar'}, {'saml_attr': 'foobar'}),
|
({'saml_attr': 'foobar'}, {'saml_attr': 'foobar'}),
|
||||||
({'remove': True}, {'remove': True}),
|
({'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):
|
def test_internal_value_valid(self, data, expected):
|
||||||
field = SAMLOrgAttrField()
|
field = SAMLOrgAttrField()
|
||||||
@@ -33,6 +38,10 @@ class TestSAMLOrgAttrField():
|
|||||||
ValidationError('Not a valid string.')),
|
ValidationError('Not a valid string.')),
|
||||||
({'remove': True, 'saml_attr': False, 'foo': 'bar', 'gig': 'ity'},
|
({'remove': True, 'saml_attr': False, 'foo': 'bar', 'gig': 'ity'},
|
||||||
ValidationError('Invalid key(s): "gig", "foo".')),
|
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):
|
def test_internal_value_invalid(self, data, expected):
|
||||||
field = SAMLOrgAttrField()
|
field = SAMLOrgAttrField()
|
||||||
|
|||||||
Reference in New Issue
Block a user