tests: add xmlrpc test for ipa user-add --radius-username

Add a xmlrpc test for ipa user-add/user-mod --radius-username
The command were previously failing because the objectclass
ipatokenradiusproxyuser was not automatically added when the
attribute ipatokenRadiusUserName was added to the entry.

The test ensures that the command is now succeeding.

Related to https://pagure.io/freeipa/issue/7569

Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Christian Heimes <cheimes@redhat.com>
This commit is contained in:
Florence Blanc-Renaud 2018-11-07 11:22:25 +01:00 committed by Christian Heimes
parent 19cd960387
commit 1c2c2ee6f8

View File

@ -138,6 +138,19 @@ def user_npg2(request, group):
return tracker.make_fixture(request)
@pytest.fixture(scope='class')
def user_radius(request):
""" User tracker fixture for testing users with radius user name """
tracker = UserTracker(name=u'radiususer', givenname=u'radiususer',
sn=u'radiususer1',
ipatokenradiususername=u'radiususer')
tracker.track_create()
tracker.attrs.update(
objectclass=objectclasses.user + [u'ipatokenradiusproxyuser']
)
return tracker.make_fixture(request)
@pytest.fixture(scope='class')
def group(request):
tracker = GroupTracker(name=u'group1')
@ -448,6 +461,15 @@ class TestUpdate(XMLRPC_test):
error=u'may only include letters, numbers, _, -, . and $')):
command()
def test_add_radius_username(self, user):
""" Test for ticket 7569: Try to add --radius-username """
user.ensure_exists()
command = user.make_update_command(
updates=dict(ipatokenradiususername=u'radiususer')
)
command()
user.delete()
@pytest.mark.tier1
class TestCreate(XMLRPC_test):
@ -663,6 +685,13 @@ class TestCreate(XMLRPC_test):
)):
testuser.create()
def test_create_with_radius_username(self, user_radius):
"""Test for issue 7569: try to create a user with --radius-username"""
command = user_radius.make_create_command()
result = command()
user_radius.check_create(result)
user_radius.delete()
@pytest.mark.tier1
class TestUserWithGroup(XMLRPC_test):