From 1c2c2ee6f815babc0ac59040e03e3075d7319e59 Mon Sep 17 00:00:00 2001 From: Florence Blanc-Renaud Date: Wed, 7 Nov 2018 11:22:25 +0100 Subject: [PATCH] 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 Reviewed-By: Christian Heimes --- ipatests/test_xmlrpc/test_user_plugin.py | 29 ++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/ipatests/test_xmlrpc/test_user_plugin.py b/ipatests/test_xmlrpc/test_user_plugin.py index 08d73f4b8..06a67cfb6 100644 --- a/ipatests/test_xmlrpc/test_user_plugin.py +++ b/ipatests/test_xmlrpc/test_user_plugin.py @@ -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):