From 10ccc3bab0b32dc5eaffb91aa280b9a826ba532b Mon Sep 17 00:00:00 2001 From: Florence Blanc-Renaud Date: Nov 13 2018 13:26:23 +0000 Subject: 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 --- diff --git a/ipatests/test_xmlrpc/test_user_plugin.py b/ipatests/test_xmlrpc/test_user_plugin.py index 08d73f4..06a67cf 100644 --- a/ipatests/test_xmlrpc/test_user_plugin.py +++ b/ipatests/test_xmlrpc/test_user_plugin.py @@ -139,6 +139,19 @@ def user_npg2(request, group): @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') return tracker.make_fixture(request) @@ -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):