Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin
On 25.01.2016 15:12, Aleš Mareček wrote: Tested + several other dependent tests executed as well - PASS. The patch looks good, ACK. - Original Message - From: "Filip Skola" To: "Milan Kubík" Cc: freeipa-devel@redhat.com, "Aleš Mareček" Sent: Monday, January 25, 2016 11:55:35 AM Subject: Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin - Original Message - On 01/15/2016 03:41 PM, Filip Skola wrote: Hi, sending rebased patch on top of 58c42ddac0964a8cce7c1e1faa7516da53f028ad. Includes a "fix" for the rename-to-invalid-username issue for the new version. F. - Original Message - Hi, I don't know what is causing the \r\n issue. I use vim and than send each email with claws-mail. Didn't spot this issue when trying emailing the patch to my other address. I'm trying to send it from zimbra now, let me know if that helped pls. Fix for the stageuser plugin issues caused by this patch should have been included in the last update; I think the remaining issue is not caused by UserTracker changes. Please correct me, if I'm wrong. There is some issue with "test_rename_to_too_long_login" test. It fails but actually this is false positive because it is possible to create login upto 255 characters. I don't know why test mentions 32 characters without any other modified setup. NACK for now. - alich - This has been changed. This test still fails, though. Filip - Original Message - From: "Aleš Mareček" To: "Filip Škola" Cc: freeipa-devel@redhat.com, "Milan Kubík" Sent: Thursday, December 10, 2015 4:11:47 PM Subject: Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin Ah, sorry, haven't realized there had been devel list attached. Ok, there is some problem with \r\n in the patch. Filip, please take a look at it... Thanks... - alich - - Original Message - From: "Filip Škola" To: "Aleš Mareček" Cc: freeipa-devel@redhat.com, "Milan Kubík" Sent: Thursday, December 10, 2015 11:29:52 AM Subject: Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin Hi, this if fixed. Also issues with test_stageuser_plugin caused by UserTracker changes should be fixed here. Filip On Mon, 7 Dec 2015 09:29:31 -0500 (EST) Aleš Mareček wrote: NACK. $ ./make-lint * Module ipatests.test_xmlrpc.test_user_plugin ipatests/test_xmlrpc/test_user_plugin.py:42: [E0611(no-name-in-module), ] No name 'ldaptracker' in module 'ipatests.test_xmlrpc') $ grep ldaptracker ipatests/test_xmlrpc/test_user_plugin.py from ipatests.test_xmlrpc.ldaptracker import Tracker $ ls ipatests/test_xmlrpc/ldaptracker* ls: cannot access ipatests/test_xmlrpc/ldaptracker*: No such file or directory - Original Message ----- From: "Filip Škola" To: "Milan Kubík" Cc: freeipa-devel@redhat.com Sent: Thursday, December 3, 2015 5:38:43 PM Subject: Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin Hi, sending corrected version. F. On Thu, 12 Nov 2015 14:03:19 +0100 Milan Kubík wrote: On 11/10/2015 12:13 PM, Filip Škola wrote: Hi, fixed. F. On Tue, 10 Nov 2015 10:52:45 +0100 Milan Kubík wrote: On 11/09/2015 04:35 PM, Filip Škola wrote: Another patch was applied in the meantime. Attaching an updated version. F. On Mon, 9 Nov 2015 13:35:02 +0100 Milan Kubík wrote: On 11/06/2015 11:32 AM, Filip Škola wrote: Hi, the patch doesn't apply. Please fix this. ipatests/test_xmlrpc/test_user_plugin.py:1419: [E0602(undefined-variable), TestDeniedBindWithExpiredPrincipal.teardown_class] Undefined variable 'user1') Also, use the version numbers for your changed patches. Thanks for the patch. Several issues: 1. Use dict.items instead of dict.iteritems, for python3 compatibility 2. What is the purpose of TestPrepare class? The 'purge' methods do not call any ipa commands. Tracker.make_fixture should be used to make the Tracked resources clean themselves up when they're out of scope. 3. Why reference the resources by hardcoded name if they have a fixture representation? 4. Rewrite {create,delete}_test_group to a fixture. You may want to use different scope (or not). 5. In `def atest_rename_to_invalid_login(self, user):` - use pytest.skipif decorator and provide a reason if you must, do not obfuscate method name in order not to run it. -- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code -- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code NACK, there are errors occuring that do not appear in the respective test cases in the declarative test. In the original module t
Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin
Tested + several other dependent tests executed as well - PASS. The patch looks good, ACK. - Original Message - > From: "Filip Skola" > To: "Milan Kubík" > Cc: freeipa-devel@redhat.com, "Aleš Mareček" > Sent: Monday, January 25, 2016 11:55:35 AM > Subject: Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin > > > > - Original Message - > > On 01/15/2016 03:41 PM, Filip Skola wrote: > > > Hi, > > > > > > sending rebased patch on top of 58c42ddac0964a8cce7c1e1faa7516da53f028ad. > > > > > > Includes a "fix" for the rename-to-invalid-username issue for the new > > > version. > > > > > > F. > > > > > > - Original Message - > > >> Hi, > > >> > > >> I don't know what is causing the \r\n issue. I use vim and than send > > >> each > > >> email with claws-mail. Didn't spot this issue when trying emailing the > > >> patch > > >> to my other address. I'm trying to send it from zimbra now, let me know > > >> if > > >> that helped pls. > > >> > > >> Fix for the stageuser plugin issues caused by this patch should have > > >> been > > >> included in the last update; I think the remaining issue is not caused > > >> by > > >> UserTracker changes. Please correct me, if I'm wrong. > > >> > > >>> There is some issue with "test_rename_to_too_long_login" test. It fails > > >>> but > > >>> actually this is false positive because it is possible to create login > > >>> upto > > >>> 255 characters. I don't know why test mentions 32 characters without > > >>> any > > >>> other modified setup. > > >>> NACK for now. > > >>> - alich - > > >> This has been changed. This test still fails, though. > > >> > > >> Filip > > >> > > >>> > > >>> - Original Message - > > >>>> From: "Aleš Mareček" > > >>>> To: "Filip Škola" > > >>>> Cc: freeipa-devel@redhat.com, "Milan Kubík" > > >>>> Sent: Thursday, December 10, 2015 4:11:47 PM > > >>>> Subject: Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin > > >>>> > > >>>> Ah, sorry, haven't realized there had been devel list attached. > > >>>> Ok, there is some problem with \r\n in the patch. > > >>>> Filip, please take a look at it... > > >>>> Thanks... > > >>>> - alich - > > >>>> > > >>>> - Original Message - > > >>>>> From: "Filip Škola" > > >>>>> To: "Aleš Mareček" > > >>>>> Cc: freeipa-devel@redhat.com, "Milan Kubík" > > >>>>> Sent: Thursday, December 10, 2015 11:29:52 AM > > >>>>> Subject: Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin > > >>>>> > > >>>>> Hi, > > >>>>> > > >>>>> this if fixed. Also issues with test_stageuser_plugin caused by > > >>>>> UserTracker changes should be fixed here. > > >>>>> > > >>>>> Filip > > >>>>> > > >>>>> > > >>>>> On Mon, 7 Dec 2015 09:29:31 -0500 (EST) > > >>>>> Aleš Mareček wrote: > > >>>>> > > >>>>>> NACK. > > >>>>>> > > >>>>>> $ ./make-lint > > >>>>>> * Module ipatests.test_xmlrpc.test_user_plugin > > >>>>>> ipatests/test_xmlrpc/test_user_plugin.py:42: > > >>>>>> [E0611(no-name-in-module), ] No name 'ldaptracker' in module > > >>>>>> 'ipatests.test_xmlrpc') > > >>>>>> > > >>>>>> $ grep ldaptracker ipatests/test_xmlrpc/test_user_plugin.py > > >>>>>> from ipatests.test_xmlrpc.ldaptracker import Tracker > > >>>>>> $ ls ipatests/test_xmlrpc/ldaptracker* > > >>>>>> ls: cannot access ipatests/test_xmlrpc/ldaptracker*: No such file or > > >>>>>> directory > > >>>>>> > > >>&
Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin
- Original Message - > On 01/15/2016 03:41 PM, Filip Skola wrote: > > Hi, > > > > sending rebased patch on top of 58c42ddac0964a8cce7c1e1faa7516da53f028ad. > > > > Includes a "fix" for the rename-to-invalid-username issue for the new > > version. > > > > F. > > > > - Original Message - > >> Hi, > >> > >> I don't know what is causing the \r\n issue. I use vim and than send each > >> email with claws-mail. Didn't spot this issue when trying emailing the > >> patch > >> to my other address. I'm trying to send it from zimbra now, let me know if > >> that helped pls. > >> > >> Fix for the stageuser plugin issues caused by this patch should have been > >> included in the last update; I think the remaining issue is not caused by > >> UserTracker changes. Please correct me, if I'm wrong. > >> > >>> There is some issue with "test_rename_to_too_long_login" test. It fails > >>> but > >>> actually this is false positive because it is possible to create login > >>> upto > >>> 255 characters. I don't know why test mentions 32 characters without any > >>> other modified setup. > >>> NACK for now. > >>> - alich - > >> This has been changed. This test still fails, though. > >> > >> Filip > >> > >>> > >>> - Original Message - > >>>> From: "Aleš Mareček" > >>>> To: "Filip Škola" > >>>> Cc: freeipa-devel@redhat.com, "Milan Kubík" > >>>> Sent: Thursday, December 10, 2015 4:11:47 PM > >>>> Subject: Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin > >>>> > >>>> Ah, sorry, haven't realized there had been devel list attached. > >>>> Ok, there is some problem with \r\n in the patch. > >>>> Filip, please take a look at it... > >>>> Thanks... > >>>> - alich - > >>>> > >>>> - Original Message - > >>>>> From: "Filip Škola" > >>>>> To: "Aleš Mareček" > >>>>> Cc: freeipa-devel@redhat.com, "Milan Kubík" > >>>>> Sent: Thursday, December 10, 2015 11:29:52 AM > >>>>> Subject: Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin > >>>>> > >>>>> Hi, > >>>>> > >>>>> this if fixed. Also issues with test_stageuser_plugin caused by > >>>>> UserTracker changes should be fixed here. > >>>>> > >>>>> Filip > >>>>> > >>>>> > >>>>> On Mon, 7 Dec 2015 09:29:31 -0500 (EST) > >>>>> Aleš Mareček wrote: > >>>>> > >>>>>> NACK. > >>>>>> > >>>>>> $ ./make-lint > >>>>>> * Module ipatests.test_xmlrpc.test_user_plugin > >>>>>> ipatests/test_xmlrpc/test_user_plugin.py:42: > >>>>>> [E0611(no-name-in-module), ] No name 'ldaptracker' in module > >>>>>> 'ipatests.test_xmlrpc') > >>>>>> > >>>>>> $ grep ldaptracker ipatests/test_xmlrpc/test_user_plugin.py > >>>>>> from ipatests.test_xmlrpc.ldaptracker import Tracker > >>>>>> $ ls ipatests/test_xmlrpc/ldaptracker* > >>>>>> ls: cannot access ipatests/test_xmlrpc/ldaptracker*: No such file or > >>>>>> directory > >>>>>> > >>>>>> > >>>>>> - Original Message - > >>>>>>> From: "Filip Škola" > >>>>>>> To: "Milan Kubík" > >>>>>>> Cc: freeipa-devel@redhat.com > >>>>>>> Sent: Thursday, December 3, 2015 5:38:43 PM > >>>>>>> Subject: Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin > >>>>>>> > >>>>>>> Hi, > >>>>>>> > >>>>>>> sending corrected version. > >>>>>>> > >>>>>>> F. > >>>>>>> > >>>>>>> On Thu, 12 Nov 2015 14:03:19 +0100 > >>>>>>> Milan Kubík wrote: > >>>>>>> > >>>>>>
Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin
On 01/15/2016 03:41 PM, Filip Skola wrote: Hi, sending rebased patch on top of 58c42ddac0964a8cce7c1e1faa7516da53f028ad. Includes a "fix" for the rename-to-invalid-username issue for the new version. F. - Original Message - Hi, I don't know what is causing the \r\n issue. I use vim and than send each email with claws-mail. Didn't spot this issue when trying emailing the patch to my other address. I'm trying to send it from zimbra now, let me know if that helped pls. Fix for the stageuser plugin issues caused by this patch should have been included in the last update; I think the remaining issue is not caused by UserTracker changes. Please correct me, if I'm wrong. There is some issue with "test_rename_to_too_long_login" test. It fails but actually this is false positive because it is possible to create login upto 255 characters. I don't know why test mentions 32 characters without any other modified setup. NACK for now. - alich - This has been changed. This test still fails, though. Filip - Original Message - From: "Aleš Mareček" To: "Filip Škola" Cc: freeipa-devel@redhat.com, "Milan Kubík" Sent: Thursday, December 10, 2015 4:11:47 PM Subject: Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin Ah, sorry, haven't realized there had been devel list attached. Ok, there is some problem with \r\n in the patch. Filip, please take a look at it... Thanks... - alich - - Original Message - From: "Filip Škola" To: "Aleš Mareček" Cc: freeipa-devel@redhat.com, "Milan Kubík" Sent: Thursday, December 10, 2015 11:29:52 AM Subject: Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin Hi, this if fixed. Also issues with test_stageuser_plugin caused by UserTracker changes should be fixed here. Filip On Mon, 7 Dec 2015 09:29:31 -0500 (EST) Aleš Mareček wrote: NACK. $ ./make-lint * Module ipatests.test_xmlrpc.test_user_plugin ipatests/test_xmlrpc/test_user_plugin.py:42: [E0611(no-name-in-module), ] No name 'ldaptracker' in module 'ipatests.test_xmlrpc') $ grep ldaptracker ipatests/test_xmlrpc/test_user_plugin.py from ipatests.test_xmlrpc.ldaptracker import Tracker $ ls ipatests/test_xmlrpc/ldaptracker* ls: cannot access ipatests/test_xmlrpc/ldaptracker*: No such file or directory - Original Message - From: "Filip Škola" To: "Milan Kubík" Cc: freeipa-devel@redhat.com Sent: Thursday, December 3, 2015 5:38:43 PM Subject: Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin Hi, sending corrected version. F. On Thu, 12 Nov 2015 14:03:19 +0100 Milan Kubík wrote: On 11/10/2015 12:13 PM, Filip Škola wrote: Hi, fixed. F. On Tue, 10 Nov 2015 10:52:45 +0100 Milan Kubík wrote: On 11/09/2015 04:35 PM, Filip Škola wrote: Another patch was applied in the meantime. Attaching an updated version. F. On Mon, 9 Nov 2015 13:35:02 +0100 Milan Kubík wrote: On 11/06/2015 11:32 AM, Filip Škola wrote: Hi, the patch doesn't apply. Please fix this. ipatests/test_xmlrpc/test_user_plugin.py:1419: [E0602(undefined-variable), TestDeniedBindWithExpiredPrincipal.teardown_class] Undefined variable 'user1') Also, use the version numbers for your changed patches. Thanks for the patch. Several issues: 1. Use dict.items instead of dict.iteritems, for python3 compatibility 2. What is the purpose of TestPrepare class? The 'purge' methods do not call any ipa commands. Tracker.make_fixture should be used to make the Tracked resources clean themselves up when they're out of scope. 3. Why reference the resources by hardcoded name if they have a fixture representation? 4. Rewrite {create,delete}_test_group to a fixture. You may want to use different scope (or not). 5. In `def atest_rename_to_invalid_login(self, user):` - use pytest.skipif decorator and provide a reason if you must, do not obfuscate method name in order not to run it. -- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code -- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code NACK, there are errors occuring that do not appear in the respective test cases in the declarative test. In the original module the ` Test a login name that is too long` and `Try to rename to a username that is too long` do not use {add,set}attr. Why do you use them? I'm also postponing the review of your other patches as they depend on changes in this one. -- Milan Kubik -- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code
Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin
Hi, sending rebased patch on top of 58c42ddac0964a8cce7c1e1faa7516da53f028ad. Includes a "fix" for the rename-to-invalid-username issue for the new version. F. - Original Message - > Hi, > > I don't know what is causing the \r\n issue. I use vim and than send each > email with claws-mail. Didn't spot this issue when trying emailing the patch > to my other address. I'm trying to send it from zimbra now, let me know if > that helped pls. > > Fix for the stageuser plugin issues caused by this patch should have been > included in the last update; I think the remaining issue is not caused by > UserTracker changes. Please correct me, if I'm wrong. > > > There is some issue with "test_rename_to_too_long_login" test. It fails but > > actually this is false positive because it is possible to create login upto > > 255 characters. I don't know why test mentions 32 characters without any > > other modified setup. > > NACK for now. > > - alich - > > This has been changed. This test still fails, though. > > Filip > > > > > > > - Original Message - > > > From: "Aleš Mareček" > > > To: "Filip Škola" > > > Cc: freeipa-devel@redhat.com, "Milan Kubík" > > > Sent: Thursday, December 10, 2015 4:11:47 PM > > > Subject: Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin > > > > > > Ah, sorry, haven't realized there had been devel list attached. > > > Ok, there is some problem with \r\n in the patch. > > > Filip, please take a look at it... > > > Thanks... > > > - alich - > > > > > > - Original Message - > > > > From: "Filip Škola" > > > > To: "Aleš Mareček" > > > > Cc: freeipa-devel@redhat.com, "Milan Kubík" > > > > Sent: Thursday, December 10, 2015 11:29:52 AM > > > > Subject: Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin > > > > > > > > Hi, > > > > > > > > this if fixed. Also issues with test_stageuser_plugin caused by > > > > UserTracker changes should be fixed here. > > > > > > > > Filip > > > > > > > > > > > > On Mon, 7 Dec 2015 09:29:31 -0500 (EST) > > > > Aleš Mareček wrote: > > > > > > > > > NACK. > > > > > > > > > > $ ./make-lint > > > > > * Module ipatests.test_xmlrpc.test_user_plugin > > > > > ipatests/test_xmlrpc/test_user_plugin.py:42: > > > > > [E0611(no-name-in-module), ] No name 'ldaptracker' in module > > > > > 'ipatests.test_xmlrpc') > > > > > > > > > > $ grep ldaptracker ipatests/test_xmlrpc/test_user_plugin.py > > > > > from ipatests.test_xmlrpc.ldaptracker import Tracker > > > > > $ ls ipatests/test_xmlrpc/ldaptracker* > > > > > ls: cannot access ipatests/test_xmlrpc/ldaptracker*: No such file or > > > > > directory > > > > > > > > > > > > > > > - Original Message - > > > > > > From: "Filip Škola" > > > > > > To: "Milan Kubík" > > > > > > Cc: freeipa-devel@redhat.com > > > > > > Sent: Thursday, December 3, 2015 5:38:43 PM > > > > > > Subject: Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin > > > > > > > > > > > > Hi, > > > > > > > > > > > > sending corrected version. > > > > > > > > > > > > F. > > > > > > > > > > > > On Thu, 12 Nov 2015 14:03:19 +0100 > > > > > > Milan Kubík wrote: > > > > > > > > > > > > > On 11/10/2015 12:13 PM, Filip Škola wrote: > > > > > > > > Hi, > > > > > > > > > > > > > > > > fixed. > > > > > > > > > > > > > > > > F. > > > > > > > > > > > > > > > > On Tue, 10 Nov 2015 10:52:45 +0100 > > > > > > > > Milan Kubík wrote: > > > > > > > > > > > > > > > >> On 11/09/2015 04:35 PM, Filip Škola wrote: > > > > > > > >>> Another patch was applied in the meantime. > > > > > > > >>> > > > &g
Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin
Hi, I don't know what is causing the \r\n issue. I use vim and than send each email with claws-mail. Didn't spot this issue when trying emailing the patch to my other address. I'm trying to send it from zimbra now, let me know if that helped pls. Fix for the stageuser plugin issues caused by this patch should have been included in the last update; I think the remaining issue is not caused by UserTracker changes. Please correct me, if I'm wrong. > There is some issue with "test_rename_to_too_long_login" test. It fails but > actually this is false positive because it is possible to create login upto > 255 characters. I don't know why test mentions 32 characters without any > other modified setup. > NACK for now. > - alich - This has been changed. This test still fails, though. Filip > > > - Original Message - > > From: "Aleš Mareček" > > To: "Filip Škola" > > Cc: freeipa-devel@redhat.com, "Milan Kubík" > > Sent: Thursday, December 10, 2015 4:11:47 PM > > Subject: Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin > > > > Ah, sorry, haven't realized there had been devel list attached. > > Ok, there is some problem with \r\n in the patch. > > Filip, please take a look at it... > > Thanks... > > - alich - > > > > - Original Message - > > > From: "Filip Škola" > > > To: "Aleš Mareček" > > > Cc: freeipa-devel@redhat.com, "Milan Kubík" > > > Sent: Thursday, December 10, 2015 11:29:52 AM > > > Subject: Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin > > > > > > Hi, > > > > > > this if fixed. Also issues with test_stageuser_plugin caused by > > > UserTracker changes should be fixed here. > > > > > > Filip > > > > > > > > > On Mon, 7 Dec 2015 09:29:31 -0500 (EST) > > > Aleš Mareček wrote: > > > > > > > NACK. > > > > > > > > $ ./make-lint > > > > * Module ipatests.test_xmlrpc.test_user_plugin > > > > ipatests/test_xmlrpc/test_user_plugin.py:42: > > > > [E0611(no-name-in-module), ] No name 'ldaptracker' in module > > > > 'ipatests.test_xmlrpc') > > > > > > > > $ grep ldaptracker ipatests/test_xmlrpc/test_user_plugin.py > > > > from ipatests.test_xmlrpc.ldaptracker import Tracker > > > > $ ls ipatests/test_xmlrpc/ldaptracker* > > > > ls: cannot access ipatests/test_xmlrpc/ldaptracker*: No such file or > > > > directory > > > > > > > > > > > > - Original Message - > > > > > From: "Filip Škola" > > > > > To: "Milan Kubík" > > > > > Cc: freeipa-devel@redhat.com > > > > > Sent: Thursday, December 3, 2015 5:38:43 PM > > > > > Subject: Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin > > > > > > > > > > Hi, > > > > > > > > > > sending corrected version. > > > > > > > > > > F. > > > > > > > > > > On Thu, 12 Nov 2015 14:03:19 +0100 > > > > > Milan Kubík wrote: > > > > > > > > > > > On 11/10/2015 12:13 PM, Filip Škola wrote: > > > > > > > Hi, > > > > > > > > > > > > > > fixed. > > > > > > > > > > > > > > F. > > > > > > > > > > > > > > On Tue, 10 Nov 2015 10:52:45 +0100 > > > > > > > Milan Kubík wrote: > > > > > > > > > > > > > >> On 11/09/2015 04:35 PM, Filip Škola wrote: > > > > > > >>> Another patch was applied in the meantime. > > > > > > >>> > > > > > > >>> Attaching an updated version. > > > > > > >>> > > > > > > >>> F. > > > > > > >>> > > > > > > >>> On Mon, 9 Nov 2015 13:35:02 +0100 > > > > > > >>> Milan Kubík wrote: > > > > > > >>> > > > > > > >>>> On 11/06/2015 11:32 AM, Filip Škola wrote: > > > > > > >>>> Hi, > > > > > > >>>> the patch doesn't apply. > > > > > > >>>> > > > > > > >> Please fix this
Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin
Ah, sorry, haven't realized there had been devel list attached. Ok, there is some problem with \r\n in the patch. Filip, please take a look at it... Thanks... - alich - - Original Message - > From: "Filip Škola" > To: "Aleš Mareček" > Cc: freeipa-devel@redhat.com, "Milan Kubík" > Sent: Thursday, December 10, 2015 11:29:52 AM > Subject: Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin > > Hi, > > this if fixed. Also issues with test_stageuser_plugin caused by > UserTracker changes should be fixed here. > > Filip > > > On Mon, 7 Dec 2015 09:29:31 -0500 (EST) > Aleš Mareček wrote: > > > NACK. > > > > $ ./make-lint > > * Module ipatests.test_xmlrpc.test_user_plugin > > ipatests/test_xmlrpc/test_user_plugin.py:42: > > [E0611(no-name-in-module), ] No name 'ldaptracker' in module > > 'ipatests.test_xmlrpc') > > > > $ grep ldaptracker ipatests/test_xmlrpc/test_user_plugin.py > > from ipatests.test_xmlrpc.ldaptracker import Tracker > > $ ls ipatests/test_xmlrpc/ldaptracker* > > ls: cannot access ipatests/test_xmlrpc/ldaptracker*: No such file or > > directory > > > > > > - Original Message - > > > From: "Filip Škola" > > > To: "Milan Kubík" > > > Cc: freeipa-devel@redhat.com > > > Sent: Thursday, December 3, 2015 5:38:43 PM > > > Subject: Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin > > > > > > Hi, > > > > > > sending corrected version. > > > > > > F. > > > > > > On Thu, 12 Nov 2015 14:03:19 +0100 > > > Milan Kubík wrote: > > > > > > > On 11/10/2015 12:13 PM, Filip Škola wrote: > > > > > Hi, > > > > > > > > > > fixed. > > > > > > > > > > F. > > > > > > > > > > On Tue, 10 Nov 2015 10:52:45 +0100 > > > > > Milan Kubík wrote: > > > > > > > > > >> On 11/09/2015 04:35 PM, Filip Škola wrote: > > > > >>> Another patch was applied in the meantime. > > > > >>> > > > > >>> Attaching an updated version. > > > > >>> > > > > >>> F. > > > > >>> > > > > >>> On Mon, 9 Nov 2015 13:35:02 +0100 > > > > >>> Milan Kubík wrote: > > > > >>> > > > > >>>> On 11/06/2015 11:32 AM, Filip Škola wrote: > > > > >>>> Hi, > > > > >>>> the patch doesn't apply. > > > > >>>> > > > > >> Please fix this. > > > > >> > > > > >> ipatests/test_xmlrpc/test_user_plugin.py:1419: > > > > >> [E0602(undefined-variable), > > > > >> TestDeniedBindWithExpiredPrincipal.teardown_class] Undefined > > > > >> variable 'user1') > > > > >> > > > > >> Also, use the version numbers for your changed patches. > > > > >> > > > > > > > > > > > > > > Thanks for the patch. Several issues: > > > > > > > > 1. Use dict.items instead of dict.iteritems, for python3 > > > > compatibility > > > > > > > > 2. What is the purpose of TestPrepare class? The 'purge' methods > > > > do not call any ipa commands. > > > > Tracker.make_fixture should be used to make the Tracked resources > > > > clean themselves up when they're out of scope. > > > > > > > > 3. Why reference the resources by hardcoded name if they have a > > > > fixture representation? > > > > > > > > 4. Rewrite {create,delete}_test_group to a fixture. You may want > > > > to use different scope (or not). > > > > > > > > 5. In `def atest_rename_to_invalid_login(self, user):` - use > > > > pytest.skipif decorator and provide a reason if you must, > > > > do not obfuscate method name in order not to run it. > > > > > > > > > > > > > > > > > -- > > > Manage your subscription for the Freeipa-devel mailing list: > > > https://www.redhat.com/mailman/listinfo/freeipa-devel > > > Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code > > -- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code
Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin
There is some issue with "test_rename_to_too_long_login" test. It fails but actually this is false positive because it is possible to create login upto 255 characters. I don't know why test mentions 32 characters without any other modified setup. NACK for now. - alich - - Original Message - > From: "Aleš Mareček" > To: "Filip Škola" > Cc: freeipa-devel@redhat.com, "Milan Kubík" > Sent: Thursday, December 10, 2015 4:11:47 PM > Subject: Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin > > Ah, sorry, haven't realized there had been devel list attached. > Ok, there is some problem with \r\n in the patch. > Filip, please take a look at it... > Thanks... > - alich - > > - Original Message - > > From: "Filip Škola" > > To: "Aleš Mareček" > > Cc: freeipa-devel@redhat.com, "Milan Kubík" > > Sent: Thursday, December 10, 2015 11:29:52 AM > > Subject: Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin > > > > Hi, > > > > this if fixed. Also issues with test_stageuser_plugin caused by > > UserTracker changes should be fixed here. > > > > Filip > > > > > > On Mon, 7 Dec 2015 09:29:31 -0500 (EST) > > Aleš Mareček wrote: > > > > > NACK. > > > > > > $ ./make-lint > > > * Module ipatests.test_xmlrpc.test_user_plugin > > > ipatests/test_xmlrpc/test_user_plugin.py:42: > > > [E0611(no-name-in-module), ] No name 'ldaptracker' in module > > > 'ipatests.test_xmlrpc') > > > > > > $ grep ldaptracker ipatests/test_xmlrpc/test_user_plugin.py > > > from ipatests.test_xmlrpc.ldaptracker import Tracker > > > $ ls ipatests/test_xmlrpc/ldaptracker* > > > ls: cannot access ipatests/test_xmlrpc/ldaptracker*: No such file or > > > directory > > > > > > > > > - Original Message - > > > > From: "Filip Škola" > > > > To: "Milan Kubík" > > > > Cc: freeipa-devel@redhat.com > > > > Sent: Thursday, December 3, 2015 5:38:43 PM > > > > Subject: Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin > > > > > > > > Hi, > > > > > > > > sending corrected version. > > > > > > > > F. > > > > > > > > On Thu, 12 Nov 2015 14:03:19 +0100 > > > > Milan Kubík wrote: > > > > > > > > > On 11/10/2015 12:13 PM, Filip Škola wrote: > > > > > > Hi, > > > > > > > > > > > > fixed. > > > > > > > > > > > > F. > > > > > > > > > > > > On Tue, 10 Nov 2015 10:52:45 +0100 > > > > > > Milan Kubík wrote: > > > > > > > > > > > >> On 11/09/2015 04:35 PM, Filip Škola wrote: > > > > > >>> Another patch was applied in the meantime. > > > > > >>> > > > > > >>> Attaching an updated version. > > > > > >>> > > > > > >>> F. > > > > > >>> > > > > > >>> On Mon, 9 Nov 2015 13:35:02 +0100 > > > > > >>> Milan Kubík wrote: > > > > > >>> > > > > > >>>> On 11/06/2015 11:32 AM, Filip Škola wrote: > > > > > >>>> Hi, > > > > > >>>> the patch doesn't apply. > > > > > >>>> > > > > > >> Please fix this. > > > > > >> > > > > > >> ipatests/test_xmlrpc/test_user_plugin.py:1419: > > > > > >> [E0602(undefined-variable), > > > > > >> TestDeniedBindWithExpiredPrincipal.teardown_class] Undefined > > > > > >> variable 'user1') > > > > > >> > > > > > >> Also, use the version numbers for your changed patches. > > > > > >> > > > > > > > > > > > > > > > > > Thanks for the patch. Several issues: > > > > > > > > > > 1. Use dict.items instead of dict.iteritems, for python3 > > > > > compatibility > > > > > > > > > > 2. What is the purpose of TestPrepare class? The 'purge' methods > > > > > do not call any ipa commands. > > > > > Tracker.make_fixture should be used to make the Tracked resources > > > > > clean themselves up when they're out of scope. > > > > > > > > > > 3. Why reference the resources by hardcoded name if they have a > > > > > fixture representation? > > > > > > > > > > 4. Rewrite {create,delete}_test_group to a fixture. You may want > > > > > to use different scope (or not). > > > > > > > > > > 5. In `def atest_rename_to_invalid_login(self, user):` - use > > > > > pytest.skipif decorator and provide a reason if you must, > > > > > do not obfuscate method name in order not to run it. > > > > > > > > > > > > > > > > > > > > > > -- > > > > Manage your subscription for the Freeipa-devel mailing list: > > > > https://www.redhat.com/mailman/listinfo/freeipa-devel > > > > Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code > > > > > -- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code
Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin
Ahoj Filipe, zase tam vidim to '\r\n'... Prisel jsi na to, co to zpusobuje? Jinak patche jdu otestovat... - alich - - Original Message - > From: "Filip Škola" > To: "Aleš Mareček" > Cc: freeipa-devel@redhat.com, "Milan Kubík" > Sent: Thursday, December 10, 2015 11:29:52 AM > Subject: Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin > > Hi, > > this if fixed. Also issues with test_stageuser_plugin caused by > UserTracker changes should be fixed here. > > Filip > > > On Mon, 7 Dec 2015 09:29:31 -0500 (EST) > Aleš Mareček wrote: > > > NACK. > > > > $ ./make-lint > > * Module ipatests.test_xmlrpc.test_user_plugin > > ipatests/test_xmlrpc/test_user_plugin.py:42: > > [E0611(no-name-in-module), ] No name 'ldaptracker' in module > > 'ipatests.test_xmlrpc') > > > > $ grep ldaptracker ipatests/test_xmlrpc/test_user_plugin.py > > from ipatests.test_xmlrpc.ldaptracker import Tracker > > $ ls ipatests/test_xmlrpc/ldaptracker* > > ls: cannot access ipatests/test_xmlrpc/ldaptracker*: No such file or > > directory > > > > > > ----- Original Message - > > > From: "Filip Škola" > > > To: "Milan Kubík" > > > Cc: freeipa-devel@redhat.com > > > Sent: Thursday, December 3, 2015 5:38:43 PM > > > Subject: Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin > > > > > > Hi, > > > > > > sending corrected version. > > > > > > F. > > > > > > On Thu, 12 Nov 2015 14:03:19 +0100 > > > Milan Kubík wrote: > > > > > > > On 11/10/2015 12:13 PM, Filip Škola wrote: > > > > > Hi, > > > > > > > > > > fixed. > > > > > > > > > > F. > > > > > > > > > > On Tue, 10 Nov 2015 10:52:45 +0100 > > > > > Milan Kubík wrote: > > > > > > > > > >> On 11/09/2015 04:35 PM, Filip Škola wrote: > > > > >>> Another patch was applied in the meantime. > > > > >>> > > > > >>> Attaching an updated version. > > > > >>> > > > > >>> F. > > > > >>> > > > > >>> On Mon, 9 Nov 2015 13:35:02 +0100 > > > > >>> Milan Kubík wrote: > > > > >>> > > > > >>>> On 11/06/2015 11:32 AM, Filip Škola wrote: > > > > >>>> Hi, > > > > >>>> the patch doesn't apply. > > > > >>>> > > > > >> Please fix this. > > > > >> > > > > >> ipatests/test_xmlrpc/test_user_plugin.py:1419: > > > > >> [E0602(undefined-variable), > > > > >> TestDeniedBindWithExpiredPrincipal.teardown_class] Undefined > > > > >> variable 'user1') > > > > >> > > > > >> Also, use the version numbers for your changed patches. > > > > >> > > > > > > > > > > > > > > Thanks for the patch. Several issues: > > > > > > > > 1. Use dict.items instead of dict.iteritems, for python3 > > > > compatibility > > > > > > > > 2. What is the purpose of TestPrepare class? The 'purge' methods > > > > do not call any ipa commands. > > > > Tracker.make_fixture should be used to make the Tracked resources > > > > clean themselves up when they're out of scope. > > > > > > > > 3. Why reference the resources by hardcoded name if they have a > > > > fixture representation? > > > > > > > > 4. Rewrite {create,delete}_test_group to a fixture. You may want > > > > to use different scope (or not). > > > > > > > > 5. In `def atest_rename_to_invalid_login(self, user):` - use > > > > pytest.skipif decorator and provide a reason if you must, > > > > do not obfuscate method name in order not to run it. > > > > > > > > > > > > > > > > > -- > > > Manage your subscription for the Freeipa-devel mailing list: > > > https://www.redhat.com/mailman/listinfo/freeipa-devel > > > Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code > > -- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code
Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin
Hi, this if fixed. Also issues with test_stageuser_plugin caused by UserTracker changes should be fixed here. Filip On Mon, 7 Dec 2015 09:29:31 -0500 (EST) Aleš Mareček wrote: > NACK. > > $ ./make-lint > * Module ipatests.test_xmlrpc.test_user_plugin > ipatests/test_xmlrpc/test_user_plugin.py:42: > [E0611(no-name-in-module), ] No name 'ldaptracker' in module > 'ipatests.test_xmlrpc') > > $ grep ldaptracker ipatests/test_xmlrpc/test_user_plugin.py > from ipatests.test_xmlrpc.ldaptracker import Tracker > $ ls ipatests/test_xmlrpc/ldaptracker* > ls: cannot access ipatests/test_xmlrpc/ldaptracker*: No such file or > directory > > > - Original Message - > > From: "Filip Škola" > > To: "Milan Kubík" > > Cc: freeipa-devel@redhat.com > > Sent: Thursday, December 3, 2015 5:38:43 PM > > Subject: Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin > > > > Hi, > > > > sending corrected version. > > > > F. > > > > On Thu, 12 Nov 2015 14:03:19 +0100 > > Milan Kubík wrote: > > > > > On 11/10/2015 12:13 PM, Filip Škola wrote: > > > > Hi, > > > > > > > > fixed. > > > > > > > > F. > > > > > > > > On Tue, 10 Nov 2015 10:52:45 +0100 > > > > Milan Kubík wrote: > > > > > > > >> On 11/09/2015 04:35 PM, Filip Škola wrote: > > > >>> Another patch was applied in the meantime. > > > >>> > > > >>> Attaching an updated version. > > > >>> > > > >>> F. > > > >>> > > > >>> On Mon, 9 Nov 2015 13:35:02 +0100 > > > >>> Milan Kubík wrote: > > > >>> > > > >>>> On 11/06/2015 11:32 AM, Filip Škola wrote: > > > >>>> Hi, > > > >>>> the patch doesn't apply. > > > >>>> > > > >> Please fix this. > > > >> > > > >> ipatests/test_xmlrpc/test_user_plugin.py:1419: > > > >> [E0602(undefined-variable), > > > >> TestDeniedBindWithExpiredPrincipal.teardown_class] Undefined > > > >> variable 'user1') > > > >> > > > >> Also, use the version numbers for your changed patches. > > > >> > > > > > > > > > > > Thanks for the patch. Several issues: > > > > > > 1. Use dict.items instead of dict.iteritems, for python3 > > > compatibility > > > > > > 2. What is the purpose of TestPrepare class? The 'purge' methods > > > do not call any ipa commands. > > > Tracker.make_fixture should be used to make the Tracked resources > > > clean themselves up when they're out of scope. > > > > > > 3. Why reference the resources by hardcoded name if they have a > > > fixture representation? > > > > > > 4. Rewrite {create,delete}_test_group to a fixture. You may want > > > to use different scope (or not). > > > > > > 5. In `def atest_rename_to_invalid_login(self, user):` - use > > > pytest.skipif decorator and provide a reason if you must, > > > do not obfuscate method name in order not to run it. > > > > > > > > > > > > -- > > Manage your subscription for the Freeipa-devel mailing list: > > https://www.redhat.com/mailman/listinfo/freeipa-devel > > Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code >From 7867154636c4b77ea7f570eb5c78e0573ff9c430 Mon Sep 17 00:00:00 2001 From: Filip Skola Date: Fri, 6 Nov 2015 10:57:37 +0100 Subject: [PATCH] Refactor test_user_plugin, use UserTracker for tests --- ipatests/test_xmlrpc/test_user_plugin.py| 2387 ++- ipatests/test_xmlrpc/tracker/user_plugin.py | 172 +- 2 files changed, 1039 insertions(+), 1520 deletions(-) diff --git a/ipatests/test_xmlrpc/test_user_plugin.py b/ipatests/test_xmlrpc/test_user_plugin.py index 084fb83c42d362204ff4547357226c8f56d217fb..155e77446230786fbbd2c137674dbed29c4350c7 100644 --- a/ipatests/test_xmlrpc/test_user_plugin.py +++ b/ipatests/test_xmlrpc/test_user_plugin.py @@ -2,6 +2,7 @@ # Rob Crittenden # Pavel Zuna # Jason Gerard DeRose +# Filip Skola # # Copyright (C) 2008, 2009 Red Hat # see file 'COPYING' for use and warranty information @@ -23,6 +24,7 @@ Test the `ipalib/plugins/user.py` module. """ +import pytest import datetime import ldap import re @@ -30,42 +32,42 @@ import re from ipalib
Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin
NACK. $ ./make-lint * Module ipatests.test_xmlrpc.test_user_plugin ipatests/test_xmlrpc/test_user_plugin.py:42: [E0611(no-name-in-module), ] No name 'ldaptracker' in module 'ipatests.test_xmlrpc') $ grep ldaptracker ipatests/test_xmlrpc/test_user_plugin.py from ipatests.test_xmlrpc.ldaptracker import Tracker $ ls ipatests/test_xmlrpc/ldaptracker* ls: cannot access ipatests/test_xmlrpc/ldaptracker*: No such file or directory - Original Message - > From: "Filip Škola" > To: "Milan Kubík" > Cc: freeipa-devel@redhat.com > Sent: Thursday, December 3, 2015 5:38:43 PM > Subject: Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin > > Hi, > > sending corrected version. > > F. > > On Thu, 12 Nov 2015 14:03:19 +0100 > Milan Kubík wrote: > > > On 11/10/2015 12:13 PM, Filip Škola wrote: > > > Hi, > > > > > > fixed. > > > > > > F. > > > > > > On Tue, 10 Nov 2015 10:52:45 +0100 > > > Milan Kubík wrote: > > > > > >> On 11/09/2015 04:35 PM, Filip Škola wrote: > > >>> Another patch was applied in the meantime. > > >>> > > >>> Attaching an updated version. > > >>> > > >>> F. > > >>> > > >>> On Mon, 9 Nov 2015 13:35:02 +0100 > > >>> Milan Kubík wrote: > > >>> > > >>>> On 11/06/2015 11:32 AM, Filip Škola wrote: > > >>>> Hi, > > >>>> the patch doesn't apply. > > >>>> > > >> Please fix this. > > >> > > >> ipatests/test_xmlrpc/test_user_plugin.py:1419: > > >> [E0602(undefined-variable), > > >> TestDeniedBindWithExpiredPrincipal.teardown_class] Undefined > > >> variable 'user1') > > >> > > >> Also, use the version numbers for your changed patches. > > >> > > > > > > > > Thanks for the patch. Several issues: > > > > 1. Use dict.items instead of dict.iteritems, for python3 compatibility > > > > 2. What is the purpose of TestPrepare class? The 'purge' methods do > > not call any ipa commands. > > Tracker.make_fixture should be used to make the Tracked resources > > clean themselves up when they're out of scope. > > > > 3. Why reference the resources by hardcoded name if they have a > > fixture representation? > > > > 4. Rewrite {create,delete}_test_group to a fixture. You may want to > > use different scope (or not). > > > > 5. In `def atest_rename_to_invalid_login(self, user):` - use > > pytest.skipif decorator and provide a reason if you must, > > do not obfuscate method name in order not to run it. > > > > > > > -- > Manage your subscription for the Freeipa-devel mailing list: > https://www.redhat.com/mailman/listinfo/freeipa-devel > Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code -- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code
Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin
Hi, sending corrected version. F. On Thu, 12 Nov 2015 14:03:19 +0100 Milan Kubík wrote: > On 11/10/2015 12:13 PM, Filip Škola wrote: > > Hi, > > > > fixed. > > > > F. > > > > On Tue, 10 Nov 2015 10:52:45 +0100 > > Milan Kubík wrote: > > > >> On 11/09/2015 04:35 PM, Filip Škola wrote: > >>> Another patch was applied in the meantime. > >>> > >>> Attaching an updated version. > >>> > >>> F. > >>> > >>> On Mon, 9 Nov 2015 13:35:02 +0100 > >>> Milan Kubík wrote: > >>> > On 11/06/2015 11:32 AM, Filip Škola wrote: > Hi, > the patch doesn't apply. > > >> Please fix this. > >> > >> ipatests/test_xmlrpc/test_user_plugin.py:1419: > >> [E0602(undefined-variable), > >> TestDeniedBindWithExpiredPrincipal.teardown_class] Undefined > >> variable 'user1') > >> > >> Also, use the version numbers for your changed patches. > >> > > > > > Thanks for the patch. Several issues: > > 1. Use dict.items instead of dict.iteritems, for python3 compatibility > > 2. What is the purpose of TestPrepare class? The 'purge' methods do > not call any ipa commands. > Tracker.make_fixture should be used to make the Tracked resources > clean themselves up when they're out of scope. > > 3. Why reference the resources by hardcoded name if they have a > fixture representation? > > 4. Rewrite {create,delete}_test_group to a fixture. You may want to > use different scope (or not). > > 5. In `def atest_rename_to_invalid_login(self, user):` - use > pytest.skipif decorator and provide a reason if you must, > do not obfuscate method name in order not to run it. > > >From e2411ccfbabbb2a9e747c547141466ed38331528 Mon Sep 17 00:00:00 2001 From: Filip Skola Date: Fri, 6 Nov 2015 10:57:37 +0100 Subject: [PATCH] Refactor test_user_plugin, use UserTracker for tests --- ipatests/test_xmlrpc/test_user_plugin.py| 2387 ++- ipatests/test_xmlrpc/tracker/user_plugin.py | 162 +- 2 files changed, 1033 insertions(+), 1516 deletions(-) diff --git a/ipatests/test_xmlrpc/test_user_plugin.py b/ipatests/test_xmlrpc/test_user_plugin.py index 084fb83c42d362204ff4547357226c8f56d217fb..7d299d228aef4881efce5b3f575c95d21a0d41d3 100644 --- a/ipatests/test_xmlrpc/test_user_plugin.py +++ b/ipatests/test_xmlrpc/test_user_plugin.py @@ -2,6 +2,7 @@ # Rob Crittenden # Pavel Zuna # Jason Gerard DeRose +# Filip Skola # # Copyright (C) 2008, 2009 Red Hat # see file 'COPYING' for use and warranty information @@ -23,6 +24,7 @@ Test the `ipalib/plugins/user.py` module. """ +import pytest import datetime import ldap import re @@ -30,42 +32,42 @@ import re from ipalib import api, errors from ipatests.test_xmlrpc import objectclasses from ipatests.util import ( -assert_equal, assert_not_equal, raises) +assert_deepequal, assert_equal, assert_not_equal, raises) from xmlrpc_test import ( -XMLRPC_test, Declarative, fuzzy_digits, fuzzy_uuid, fuzzy_password, -fuzzy_string, fuzzy_dergeneralizedtime, add_sid, add_oc) +XMLRPC_test, fuzzy_digits, fuzzy_uuid, fuzzy_password, +fuzzy_string, fuzzy_dergeneralizedtime, add_sid, add_oc, raises_exact) from ipapython.dn import DN -import pytest +from ipapython.version import API_VERSION + +from ipatests.test_xmlrpc.ldaptracker import Tracker +from ipatests.test_xmlrpc.tracker.group_plugin import GroupTracker +from ipatests.test_xmlrpc.tracker.user_plugin import UserTracker -user1 = u'tuser1' -user2 = u'tuser2' admin1 = u'admin' -admin2 = u'admin2' -renameduser1 = u'tuser' -group1 = u'group1' -admins_group = u'admins' +admin_group = u'admins' invaliduser1 = u'+tuser1' invaliduser2 = u'tuser1234567890123456789012345678901234567890' sshpubkey = (u'ssh-rsa B3NzaC1yc2EDAQABAAABAQDGAX3xAeLeaJggwTqMjxNwa6X' - 'HBUAikXPGMzEpVrlLDCZtv00djsFTBi38PkgxBJVkgRWMrcBsr/35lq7P6w8KGI' - 'wA8GI48Z0qBS2NBMJ2u9WQ2hjLN6GdMlo77O0uJY3251p12pCVIS/bHRSq8kHO2' - 'No8g7KA9fGGcagPfQH+ee3t7HUkpbQkFTmbPPN++r3V8oVUk5LxbryB3UIIVzNm' - 'cSIn3JrXynlvui4MixvrtX6zx+O/bBo68o8/eZD26QrahVbA09fivrn/4h3TM01' - '9Eu/c2jOdckfU3cHUV/3Tno5d6JicibyaoDDK7S/yjdn5jhaz8MSEayQvFkZkiF' - '0L public key test') + 'HBUAikXPGMzEpVrlLDCZtv00djsFTBi38PkgxBJVkgRWMrcBsr/35lq7P6w8KGI' + 'wA8GI48Z0qBS2NBMJ2u9WQ2hjLN6GdMlo77O0uJY3251p12pCVIS/bHRSq8kHO2' + 'No8g7KA9fGGcagPfQH+ee3t7HUkpbQkFTmbPPN++r3V8oVUk5LxbryB3UIIVzNm' + 'cSIn3JrXynlvui4MixvrtX6zx+O/bBo68o8/eZD26QrahVbA09fivrn/4h3TM01' + '9Eu/c2jOdckfU3cHUV/3Tno5d6JicibyaoDDK7S/yjdn5jhaz8MSEayQvFkZkiF' + '0L public key test') sshpubkeyfp = (u'13:67:6B:BF:4E:A2:05:8E:AE:25:8B:A1:31:DE:6F:1B ' -'public key test (ssh-rsa)') + 'public key test (ssh-rsa)') -validlanguage1 = u'en-US;q=0.987 , en, abcdfgh-abcdefgh;q=1, a;q=1.000' -validlanguage2 = u'*' +validlanguages = { +u'en-US;q=0.987 , en, abcdfgh-abcdefgh;q=1, a;q=1.000', +u'*'
Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin
On 11/10/2015 12:13 PM, Filip Škola wrote: Hi, fixed. F. On Tue, 10 Nov 2015 10:52:45 +0100 Milan Kubík wrote: On 11/09/2015 04:35 PM, Filip Škola wrote: Another patch was applied in the meantime. Attaching an updated version. F. On Mon, 9 Nov 2015 13:35:02 +0100 Milan Kubík wrote: On 11/06/2015 11:32 AM, Filip Škola wrote: Hi, the patch doesn't apply. Please fix this. ipatests/test_xmlrpc/test_user_plugin.py:1419: [E0602(undefined-variable), TestDeniedBindWithExpiredPrincipal.teardown_class] Undefined variable 'user1') Also, use the version numbers for your changed patches. Thanks for the patch. Several issues: 1. Use dict.items instead of dict.iteritems, for python3 compatibility 2. What is the purpose of TestPrepare class? The 'purge' methods do not call any ipa commands. Tracker.make_fixture should be used to make the Tracked resources clean themselves up when they're out of scope. 3. Why reference the resources by hardcoded name if they have a fixture representation? 4. Rewrite {create,delete}_test_group to a fixture. You may want to use different scope (or not). 5. In `def atest_rename_to_invalid_login(self, user):` - use pytest.skipif decorator and provide a reason if you must, do not obfuscate method name in order not to run it. -- Milan Kubik -- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code
Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin
Hi, fixed. F. On Tue, 10 Nov 2015 10:52:45 +0100 Milan Kubík wrote: > On 11/09/2015 04:35 PM, Filip Škola wrote: > > Another patch was applied in the meantime. > > > > Attaching an updated version. > > > > F. > > > > On Mon, 9 Nov 2015 13:35:02 +0100 > > Milan Kubík wrote: > > > >> On 11/06/2015 11:32 AM, Filip Škola wrote: > >>> > >> Hi, > >> the patch doesn't apply. > >> > Please fix this. > > ipatests/test_xmlrpc/test_user_plugin.py:1419: > [E0602(undefined-variable), > TestDeniedBindWithExpiredPrincipal.teardown_class] Undefined variable > 'user1') > > Also, use the version numbers for your changed patches. > >From cdaa729b2bf3694f157e7f3fe62dd782e1a03334 Mon Sep 17 00:00:00 2001 From: Filip Skola Date: Fri, 6 Nov 2015 10:57:37 +0100 Subject: [PATCH] Refactor test_user_plugin, use UserTracker for tests --- ipatests/test_xmlrpc/test_user_plugin.py | 2809 +- 1 file changed, 1195 insertions(+), 1614 deletions(-) diff --git a/ipatests/test_xmlrpc/test_user_plugin.py b/ipatests/test_xmlrpc/test_user_plugin.py index 81185e449acaa127aa9429fff9587d39a2be81e6..2d63e1636abd6bb55d541df354d039404c6475e8 100644 --- a/ipatests/test_xmlrpc/test_user_plugin.py +++ b/ipatests/test_xmlrpc/test_user_plugin.py @@ -2,6 +2,7 @@ # Rob Crittenden # Pavel Zuna # Jason Gerard DeRose +# Filip Skola # # Copyright (C) 2008, 2009 Red Hat # see file 'COPYING' for use and warranty information @@ -23,6 +24,7 @@ Test the `ipalib/plugins/user.py` module. """ +import pytest import functools import datetime import ldap @@ -33,41 +35,38 @@ from ipatests.test_xmlrpc import objectclasses from ipatests.util import ( assert_equal, assert_not_equal, raises, assert_deepequal) from xmlrpc_test import ( -XMLRPC_test, Declarative, fuzzy_digits, fuzzy_uuid, fuzzy_password, +XMLRPC_test, fuzzy_digits, fuzzy_uuid, fuzzy_password, fuzzy_string, fuzzy_dergeneralizedtime, add_sid, add_oc, raises_exact) from ipapython.dn import DN from ipatests.test_xmlrpc.ldaptracker import Tracker import pytest -user1 = u'tuser1' -user2 = u'tuser2' admin1 = u'admin' -admin2 = u'admin2' -renameduser1 = u'tuser' group1 = u'group1' -admins_group = u'admins' +admin_group = u'admins' invaliduser1 = u'+tuser1' invaliduser2 = u'tuser1234567890123456789012345678901234567890' sshpubkey = (u'ssh-rsa B3NzaC1yc2EDAQABAAABAQDGAX3xAeLeaJggwTqMjxNwa6X' - 'HBUAikXPGMzEpVrlLDCZtv00djsFTBi38PkgxBJVkgRWMrcBsr/35lq7P6w8KGI' - 'wA8GI48Z0qBS2NBMJ2u9WQ2hjLN6GdMlo77O0uJY3251p12pCVIS/bHRSq8kHO2' - 'No8g7KA9fGGcagPfQH+ee3t7HUkpbQkFTmbPPN++r3V8oVUk5LxbryB3UIIVzNm' - 'cSIn3JrXynlvui4MixvrtX6zx+O/bBo68o8/eZD26QrahVbA09fivrn/4h3TM01' - '9Eu/c2jOdckfU3cHUV/3Tno5d6JicibyaoDDK7S/yjdn5jhaz8MSEayQvFkZkiF' - '0L public key test') + 'HBUAikXPGMzEpVrlLDCZtv00djsFTBi38PkgxBJVkgRWMrcBsr/35lq7P6w8KGI' + 'wA8GI48Z0qBS2NBMJ2u9WQ2hjLN6GdMlo77O0uJY3251p12pCVIS/bHRSq8kHO2' + 'No8g7KA9fGGcagPfQH+ee3t7HUkpbQkFTmbPPN++r3V8oVUk5LxbryB3UIIVzNm' + 'cSIn3JrXynlvui4MixvrtX6zx+O/bBo68o8/eZD26QrahVbA09fivrn/4h3TM01' + '9Eu/c2jOdckfU3cHUV/3Tno5d6JicibyaoDDK7S/yjdn5jhaz8MSEayQvFkZkiF' + '0L public key test') sshpubkeyfp = (u'13:67:6B:BF:4E:A2:05:8E:AE:25:8B:A1:31:DE:6F:1B ' -'public key test (ssh-rsa)') + 'public key test (ssh-rsa)') -validlanguage1 = u'en-US;q=0.987 , en, abcdfgh-abcdefgh;q=1, a;q=1.000' -validlanguage2 = u'*' +validlanguages = { +u'en-US;q=0.987 , en, abcdfgh-abcdefgh;q=1, a;q=1.000', +u'*' +} -invalidlanguage1 = u'abcdfghji-abcdfghji' -invalidlanguage2 = u'en-us;q=0,123' -invalidlanguage3 = u'en-us;q=0.1234' -invalidlanguage4 = u'en-us;q=1.1' -invalidlanguage5 = u'en-us;q=1.' +invalidlanguages = { +u'abcdfghji-abcdfghji', u'en-us;q=0,123', +u'en-us;q=0.1234', u'en-us;q=1.1', u'en-us;q=1.' +} principal_expiration_string = "2020-12-07T19:54:13Z" principal_expiration_date = datetime.datetime(2020, 12, 7, 19, 54, 13) @@ -79,1583 +78,6 @@ expired_expiration_string = "1991-12-07T19:54:13Z" isodate_re = re.compile('^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$') -def get_user_result(uid, givenname, sn, operation='show', omit=[], -**overrides): -"""Get a user result for a user-{add,mod,find,show} command - -This gives the result as from a user_add(uid, givenname=givenname, sn=sn); -modifications to that can be specified in ``omit`` and ``overrides``. - -The ``operation`` can be one of: -- add -- show -- show-all ((show with the --all flag) -- find -- mod - -Attributes named in ``omit`` are removed from the result; any additional -or non-default values can be specified in ``overrides``. -""" -# sn can be None; this should only be used from `get_admin_result` -cn = overrides.get('cn', ['%s %s' %
Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin
On 11/09/2015 04:35 PM, Filip Škola wrote: Another patch was applied in the meantime. Attaching an updated version. F. On Mon, 9 Nov 2015 13:35:02 +0100 Milan Kubík wrote: On 11/06/2015 11:32 AM, Filip Škola wrote: Hi, the patch doesn't apply. Please fix this. ipatests/test_xmlrpc/test_user_plugin.py:1419: [E0602(undefined-variable), TestDeniedBindWithExpiredPrincipal.teardown_class] Undefined variable 'user1') Also, use the version numbers for your changed patches. -- Milan Kubik -- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code
Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin
Another patch was applied in the meantime. Attaching an updated version. F. On Mon, 9 Nov 2015 13:35:02 +0100 Milan Kubík wrote: > On 11/06/2015 11:32 AM, Filip Škola wrote: > > > > > Hi, > the patch doesn't apply. > >From ff593642291cece0360ee85f58f28f1c270d41a0 Mon Sep 17 00:00:00 2001 From: Filip Skola Date: Fri, 6 Nov 2015 10:57:37 +0100 Subject: [PATCH] Refactor test_user_plugin, use UserTracker for tests --- ipatests/test_xmlrpc/test_user_plugin.py | 2810 +- 1 file changed, 1196 insertions(+), 1614 deletions(-) diff --git a/ipatests/test_xmlrpc/test_user_plugin.py b/ipatests/test_xmlrpc/test_user_plugin.py index 81185e449acaa127aa9429fff9587d39a2be81e6..63a61a908c5623431c95c76b970919145e82a2e0 100644 --- a/ipatests/test_xmlrpc/test_user_plugin.py +++ b/ipatests/test_xmlrpc/test_user_plugin.py @@ -2,6 +2,7 @@ # Rob Crittenden # Pavel Zuna # Jason Gerard DeRose +# Filip Skola # # Copyright (C) 2008, 2009 Red Hat # see file 'COPYING' for use and warranty information @@ -23,6 +24,7 @@ Test the `ipalib/plugins/user.py` module. """ +import pytest import functools import datetime import ldap @@ -33,41 +35,38 @@ from ipatests.test_xmlrpc import objectclasses from ipatests.util import ( assert_equal, assert_not_equal, raises, assert_deepequal) from xmlrpc_test import ( -XMLRPC_test, Declarative, fuzzy_digits, fuzzy_uuid, fuzzy_password, +XMLRPC_test, fuzzy_digits, fuzzy_uuid, fuzzy_password, fuzzy_string, fuzzy_dergeneralizedtime, add_sid, add_oc, raises_exact) from ipapython.dn import DN from ipatests.test_xmlrpc.ldaptracker import Tracker import pytest -user1 = u'tuser1' -user2 = u'tuser2' admin1 = u'admin' -admin2 = u'admin2' -renameduser1 = u'tuser' group1 = u'group1' -admins_group = u'admins' +admin_group = u'admins' invaliduser1 = u'+tuser1' invaliduser2 = u'tuser1234567890123456789012345678901234567890' sshpubkey = (u'ssh-rsa B3NzaC1yc2EDAQABAAABAQDGAX3xAeLeaJggwTqMjxNwa6X' - 'HBUAikXPGMzEpVrlLDCZtv00djsFTBi38PkgxBJVkgRWMrcBsr/35lq7P6w8KGI' - 'wA8GI48Z0qBS2NBMJ2u9WQ2hjLN6GdMlo77O0uJY3251p12pCVIS/bHRSq8kHO2' - 'No8g7KA9fGGcagPfQH+ee3t7HUkpbQkFTmbPPN++r3V8oVUk5LxbryB3UIIVzNm' - 'cSIn3JrXynlvui4MixvrtX6zx+O/bBo68o8/eZD26QrahVbA09fivrn/4h3TM01' - '9Eu/c2jOdckfU3cHUV/3Tno5d6JicibyaoDDK7S/yjdn5jhaz8MSEayQvFkZkiF' - '0L public key test') + 'HBUAikXPGMzEpVrlLDCZtv00djsFTBi38PkgxBJVkgRWMrcBsr/35lq7P6w8KGI' + 'wA8GI48Z0qBS2NBMJ2u9WQ2hjLN6GdMlo77O0uJY3251p12pCVIS/bHRSq8kHO2' + 'No8g7KA9fGGcagPfQH+ee3t7HUkpbQkFTmbPPN++r3V8oVUk5LxbryB3UIIVzNm' + 'cSIn3JrXynlvui4MixvrtX6zx+O/bBo68o8/eZD26QrahVbA09fivrn/4h3TM01' + '9Eu/c2jOdckfU3cHUV/3Tno5d6JicibyaoDDK7S/yjdn5jhaz8MSEayQvFkZkiF' + '0L public key test') sshpubkeyfp = (u'13:67:6B:BF:4E:A2:05:8E:AE:25:8B:A1:31:DE:6F:1B ' -'public key test (ssh-rsa)') + 'public key test (ssh-rsa)') -validlanguage1 = u'en-US;q=0.987 , en, abcdfgh-abcdefgh;q=1, a;q=1.000' -validlanguage2 = u'*' +validlanguages = { +u'en-US;q=0.987 , en, abcdfgh-abcdefgh;q=1, a;q=1.000', +u'*' +} -invalidlanguage1 = u'abcdfghji-abcdfghji' -invalidlanguage2 = u'en-us;q=0,123' -invalidlanguage3 = u'en-us;q=0.1234' -invalidlanguage4 = u'en-us;q=1.1' -invalidlanguage5 = u'en-us;q=1.' +invalidlanguages = { +u'abcdfghji-abcdfghji', u'en-us;q=0,123', +u'en-us;q=0.1234', u'en-us;q=1.1', u'en-us;q=1.' +} principal_expiration_string = "2020-12-07T19:54:13Z" principal_expiration_date = datetime.datetime(2020, 12, 7, 19, 54, 13) @@ -79,1583 +78,6 @@ expired_expiration_string = "1991-12-07T19:54:13Z" isodate_re = re.compile('^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$') -def get_user_result(uid, givenname, sn, operation='show', omit=[], -**overrides): -"""Get a user result for a user-{add,mod,find,show} command - -This gives the result as from a user_add(uid, givenname=givenname, sn=sn); -modifications to that can be specified in ``omit`` and ``overrides``. - -The ``operation`` can be one of: -- add -- show -- show-all ((show with the --all flag) -- find -- mod - -Attributes named in ``omit`` are removed from the result; any additional -or non-default values can be specified in ``overrides``. -""" -# sn can be None; this should only be used from `get_admin_result` -cn = overrides.get('cn', ['%s %s' % (givenname, sn or '')]) -cn[0] = cn[0].strip() -result = add_sid(dict( -homedirectory=[u'/home/%s' % uid], -loginshell=[u'/bin/sh'], -uid=[uid], -uidnumber=[fuzzy_digits], -gidnumber=[fuzzy_digits], -mail=[u'%s@%s' % (uid, api.env.domain)], -has_keytab=False, -has_password=False, -)) -if sn: -result['sn'] = [sn] -if give
Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin
On 11/06/2015 11:32 AM, Filip Škola wrote: Hi, the patch doesn't apply. -- Milan Kubik -- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code
[Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin
>From 881f5f980e820f178850307c0f64e3eb50cbc01e Mon Sep 17 00:00:00 2001 From: Filip Skola Date: Fri, 6 Nov 2015 10:57:37 +0100 Subject: [PATCH] Refactor test_user_plugin, use UserTracker for tests --- ipatests/test_xmlrpc/test_user_plugin.py | 2794 +- 1 file changed, 1182 insertions(+), 1612 deletions(-) diff --git a/ipatests/test_xmlrpc/test_user_plugin.py b/ipatests/test_xmlrpc/test_user_plugin.py index 3d7b5e6ba14e3ccb144575f52e4e503e6638037d..ede6a339a519dfd40fd7507ee644f1cab0d4503c 100644 --- a/ipatests/test_xmlrpc/test_user_plugin.py +++ b/ipatests/test_xmlrpc/test_user_plugin.py @@ -2,6 +2,7 @@ # Rob Crittenden # Pavel Zuna # Jason Gerard DeRose +# Filip Skola # # Copyright (C) 2008, 2009 Red Hat # see file 'COPYING' for use and warranty information @@ -23,6 +24,7 @@ Test the `ipalib/plugins/user.py` module. """ +import pytest import functools import datetime import ldap @@ -33,40 +35,37 @@ from ipatests.test_xmlrpc import objectclasses from ipatests.util import ( assert_equal, assert_not_equal, raises, assert_deepequal) from xmlrpc_test import ( -XMLRPC_test, Declarative, fuzzy_digits, fuzzy_uuid, fuzzy_password, +XMLRPC_test, fuzzy_digits, fuzzy_uuid, fuzzy_password, fuzzy_string, fuzzy_dergeneralizedtime, add_sid, add_oc, raises_exact) from ipapython.dn import DN from ipatests.test_xmlrpc.ldaptracker import Tracker -user1 = u'tuser1' -user2 = u'tuser2' admin1 = u'admin' -admin2 = u'admin2' -renameduser1 = u'tuser' group1 = u'group1' -admins_group = u'admins' +admin_group = u'admins' invaliduser1 = u'+tuser1' invaliduser2 = u'tuser1234567890123456789012345678901234567890' sshpubkey = (u'ssh-rsa B3NzaC1yc2EDAQABAAABAQDGAX3xAeLeaJggwTqMjxNwa6X' - 'HBUAikXPGMzEpVrlLDCZtv00djsFTBi38PkgxBJVkgRWMrcBsr/35lq7P6w8KGI' - 'wA8GI48Z0qBS2NBMJ2u9WQ2hjLN6GdMlo77O0uJY3251p12pCVIS/bHRSq8kHO2' - 'No8g7KA9fGGcagPfQH+ee3t7HUkpbQkFTmbPPN++r3V8oVUk5LxbryB3UIIVzNm' - 'cSIn3JrXynlvui4MixvrtX6zx+O/bBo68o8/eZD26QrahVbA09fivrn/4h3TM01' - '9Eu/c2jOdckfU3cHUV/3Tno5d6JicibyaoDDK7S/yjdn5jhaz8MSEayQvFkZkiF' - '0L public key test') + 'HBUAikXPGMzEpVrlLDCZtv00djsFTBi38PkgxBJVkgRWMrcBsr/35lq7P6w8KGI' + 'wA8GI48Z0qBS2NBMJ2u9WQ2hjLN6GdMlo77O0uJY3251p12pCVIS/bHRSq8kHO2' + 'No8g7KA9fGGcagPfQH+ee3t7HUkpbQkFTmbPPN++r3V8oVUk5LxbryB3UIIVzNm' + 'cSIn3JrXynlvui4MixvrtX6zx+O/bBo68o8/eZD26QrahVbA09fivrn/4h3TM01' + '9Eu/c2jOdckfU3cHUV/3Tno5d6JicibyaoDDK7S/yjdn5jhaz8MSEayQvFkZkiF' + '0L public key test') sshpubkeyfp = (u'13:67:6B:BF:4E:A2:05:8E:AE:25:8B:A1:31:DE:6F:1B ' -'public key test (ssh-rsa)') + 'public key test (ssh-rsa)') -validlanguage1 = u'en-US;q=0.987 , en, abcdfgh-abcdefgh;q=1, a;q=1.000' -validlanguage2 = u'*' +validlanguages = { +u'en-US;q=0.987 , en, abcdfgh-abcdefgh;q=1, a;q=1.000', +u'*' +} -invalidlanguage1 = u'abcdfghji-abcdfghji' -invalidlanguage2 = u'en-us;q=0,123' -invalidlanguage3 = u'en-us;q=0.1234' -invalidlanguage4 = u'en-us;q=1.1' -invalidlanguage5 = u'en-us;q=1.' +invalidlanguages = { +u'abcdfghji-abcdfghji', u'en-us;q=0,123', +u'en-us;q=0.1234', u'en-us;q=1.1', u'en-us;q=1.' +} principal_expiration_string = "2020-12-07T19:54:13Z" principal_expiration_date = datetime.datetime(2020, 12, 7, 19, 54, 13) @@ -78,1581 +77,6 @@ expired_expiration_string = "1991-12-07T19:54:13Z" isodate_re = re.compile('^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$') -def get_user_result(uid, givenname, sn, operation='show', omit=[], -**overrides): -"""Get a user result for a user-{add,mod,find,show} command - -This gives the result as from a user_add(uid, givenname=givenname, sn=sn); -modifications to that can be specified in ``omit`` and ``overrides``. - -The ``operation`` can be one of: -- add -- show -- show-all ((show with the --all flag) -- find -- mod - -Attributes named in ``omit`` are removed from the result; any additional -or non-default values can be specified in ``overrides``. -""" -# sn can be None; this should only be used from `get_admin_result` -cn = overrides.get('cn', ['%s %s' % (givenname, sn or '')]) -cn[0] = cn[0].strip() -result = add_sid(dict( -homedirectory=[u'/home/%s' % uid], -loginshell=[u'/bin/sh'], -uid=[uid], -uidnumber=[fuzzy_digits], -gidnumber=[fuzzy_digits], -mail=[u'%s@%s' % (uid, api.env.domain)], -has_keytab=False, -has_password=False, -)) -if sn: -result['sn'] = [sn] -if givenname: -result['givenname'] = [givenname] -if operation in ('add', 'show', 'show-all', 'find'): -result.update( -dn=get_user_dn(uid), -) -if operation in ('add', 'show-all'): -result.upda