From b24359cafae6bcc37b6281b7fb431eae47e0c9cf Mon Sep 17 00:00:00 2001 From: sumenon Date: Mon, 19 Aug 2019 15:57:01 +0530 Subject: [PATCH] Added testcase to check capitalization fix while running ipa user-mod 1. This testcase checks that when ipa user-mod command is run with capital letters there is no error shown in the console, instead the modifications for first and last name of the user is applied. 2. Adding tasks.kinit_admin since the test was being executed as different user leading to permission issue. ipa: ERROR: Insufficient access: Could not read UPG Definition originfilter. Check your permissions Issue: https://pagure.io/freeipa/issue/5879 Reviewed-By: Florence Blanc-Renaud Reviewed-By: Mohammad Rizwan Yusuf Reviewed-By: Francois Cami --- ipatests/test_integration/test_commands.py | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/ipatests/test_integration/test_commands.py b/ipatests/test_integration/test_commands.py index a035a75c4..d3c6ca9f5 100644 --- a/ipatests/test_integration/test_commands.py +++ b/ipatests/test_integration/test_commands.py @@ -643,3 +643,39 @@ class TestIPACommand(IntegrationTest): }, ) self.master.run_command(['systemctl', 'restart', 'sssd.service']) + + def test_user_mod_change_capitalization_issue5879(self): + """ + Test that an existing user which has been modified using ipa user-mod + and has the first and last name beginning with caps does not + throw the error 'ipa: ERROR: Type or value exists:' and + instead gets modified + + This is a test case for Pagure issue + https://pagure.io/freeipa/issue/5879 + + Steps: + 1. setup a master + 2. add ipa user on master + 3. now run ipa user-mod and specifying capital letters in names + 4. user details should be modified + 5. ipa: ERROR: Type or value exists is not displayed on console. + """ + # Create an ipa-user + tasks.kinit_admin(self.master) + ipauser = 'ipauser1' + first = 'ipauser' + modfirst = 'IpaUser' + last = 'test' + modlast = 'Test' + password = 'Secret123' + self.master.run_command( + ['ipa', 'user-add', ipauser, '--first', first, '--last', last, + '--password'], + stdin_text="%s\n%s\n" % (password, password)) + cmd = self.master.run_command( + ['ipa', 'user-mod', ipauser, '--first', modfirst, + '--last', modlast]) + assert 'Modified user "%s"' % (ipauser) in cmd.stdout_text + assert 'First name: %s' % (modfirst) in cmd.stdout_text + assert 'Last name: %s' % (modlast) in cmd.stdout_text