[Freeipa-devel] [PATCH 0009] Refactor test_automember_plugin

2016-04-11 Thread Filip Skola
Hi,

sending the refactored automember plugin test for review.

Filip
From 8c3abf76cfb899afb65f1a453df6a5b4815ad473 Mon Sep 17 00:00:00 2001
From: Filip Skola 
Date: Mon, 11 Apr 2016 16:59:00 +0200
Subject: [PATCH] Refactor test_automember_plugin, create AutomemberTracker

---
 ipatests/test_xmlrpc/test_automember_plugin.py| 2163 ++---
 ipatests/test_xmlrpc/tracker/automember_plugin.py |  338 
 2 files changed, 945 insertions(+), 1556 deletions(-)
 create mode 100644 ipatests/test_xmlrpc/tracker/automember_plugin.py

diff --git a/ipatests/test_xmlrpc/test_automember_plugin.py b/ipatests/test_xmlrpc/test_automember_plugin.py
index be0f7390565ed739aa66bc0c5c6d23d25d67df92..2078b1fcbbea112f101348c6ae039fa2ff3a6d28 100644
--- a/ipatests/test_xmlrpc/test_automember_plugin.py
+++ b/ipatests/test_xmlrpc/test_automember_plugin.py
@@ -21,43 +21,20 @@
 Test the `ipalib/plugins/automember.py` module.
 """
 
+from ipatests.test_xmlrpc.tracker.user_plugin import UserTracker
+from ipatests.test_xmlrpc.tracker.host_plugin import HostTracker
+from ipatests.test_xmlrpc.tracker.group_plugin import GroupTracker
+from ipatests.test_xmlrpc.tracker.hostgroup_plugin import HostGroupTracker
+from ipatests.test_xmlrpc.tracker.automember_plugin import AutomemberTracker
 from ipalib import api, errors
 from ipapython.dn import DN
-from ipatests.test_xmlrpc import objectclasses
-from ipatests.test_xmlrpc.xmlrpc_test import (
-Declarative, fuzzy_digits, fuzzy_uuid, fuzzy_automember_dn,
-fuzzy_automember_message)
-from ipatests.test_xmlrpc.test_user_plugin import get_user_result
+from ipatests.test_xmlrpc.xmlrpc_test import XMLRPC_test, raises_exact
+from ipatests.util import assert_deepequal
 
 import pytest
 
-user1 = u'tuser1'
 user_does_not_exist = u'does_not_exist'
-manager1 = u'mscott'
-fqdn1 = u'web1.%s' % api.env.domain
-short1 = u'web1'
-fqdn2 = u'dev1.%s' % api.env.domain
-short2 = u'dev1'
-fqdn3 = u'web5.%s' % api.env.domain
-short3 = u'web5'
-fqdn4 = u'www5.%s' % api.env.domain
-short4 = u'www5'
-fqdn5 = u'webserver5.%s' % api.env.domain
-short5 = u'webserver5'
 fqdn_does_not_exist = u'does_not_exist.%s' % api.env.domain
-
-group1 = u'group1'
-group1_dn = DN(('cn', group1), ('cn', 'groups'),
-   ('cn', 'accounts'), api.env.basedn)
-defaultgroup1 = u'defaultgroup1'
-hostgroup1 = u'hostgroup1'
-hostgroup1_dn = DN(('cn', hostgroup1), ('cn', 'hostgroups'),
-  ('cn', 'accounts'), api.env.basedn)
-hostgroup2 = u'hostgroup2'
-hostgroup3 = u'hostgroup3'
-hostgroup4 = u'hostgroup4'
-defaulthostgroup1 = u'defaulthostgroup1'
-
 group_include_regex = u'mscott'
 hostgroup_include_regex = u'^web[1-9]'
 hostgroup_include_regex2 = u'^www[1-9]'
@@ -67,1600 +44,674 @@ hostgroup_exclude_regex2 = u'^www5'
 hostgroup_exclude_regex3 = u'^webserver5'
 
 
-@pytest.mark.tier1
-class test_automember(Declarative):
-
-cleanup_commands = [
-('user_del', [user1, manager1], {}),
-('group_del', [group1, defaultgroup1], {}),
-('host_del', [fqdn1, fqdn2, fqdn3, fqdn4, fqdn5], {}),
-('hostgroup_del', [hostgroup1, hostgroup2, hostgroup3, hostgroup4, defaulthostgroup1], {}),
-('automember_del', [group1], {'type': u'group'}),
-('automember_del', [hostgroup1], {'type': u'hostgroup'}),
-('automember_del', [hostgroup2], {'type': u'hostgroup'}),
-('automember_del', [hostgroup3], {'type': u'hostgroup'}),
-('automember_del', [hostgroup4], {'type': u'hostgroup'}),
-('automember_default_group_remove', [], {'type': u'hostgroup'}),
-('automember_default_group_remove', [], {'type': u'group'}),
-
-]
-
-tests = [
-
-dict(
-desc='Try to retrieve non-existent group rule %r' % group1,
-command=('automember_add', [group1],
-dict(description=u'Test desc', type=u'group')),
-expected=errors.NotFound(reason=u'group "%s" not found' % group1),
-),
-
-dict(
-desc='Try to update non-existent group rule %r' % group1,
-command=('automember_add', [group1], dict(type=u'group')),
-expected=errors.NotFound(reason=u'group "%s" not found' % group1),
-),
-
-dict(
- 

Re: [Freeipa-devel] [PATCH 0005] Refactor test_nesting, create HostGroupTracker

2016-03-11 Thread Filip Skola


- Original Message -
> On 01/28/2016 10:45 AM, Filip Skola wrote:
> >
> >> The same as with patch 0002:
> >> * Module ipatests.test_xmlrpc.tracker.hostgroup_plugin
> >> W:142,26: Calling a dict.iter*() method (dict-iter-method)
> >>
> >> Please use dict.items method.
> >>
> >> --
> >> Milan Kubik
> >>
> >>
> > Hi,
> >
> > attaching a fixed patch. This patch is dependent on updated group plugin
> > test patch 0002-7.
> >
> > Filip
> Hello, sorry for delay. The patch no longer applies after 0002-8.
> 
> --
> Milan Kubik
> 
> 

Hi,

rebased. The next patch should be applicable on top of this one.

FilipFrom 120ea060fba92afa61ad559ccd3037835703b045 Mon Sep 17 00:00:00 2001
From: Filip Skola 
Date: Thu, 10 Mar 2016 17:17:20 +0100
Subject: [PATCH] Refactor test_nesting, create HostGroupTracker

---
 ipatests/test_xmlrpc/test_nesting.py | 776 +--
 ipatests/test_xmlrpc/tracker/group_plugin.py |   5 +-
 ipatests/test_xmlrpc/tracker/host_plugin.py  |   1 +
 ipatests/test_xmlrpc/tracker/hostgroup_plugin.py | 248 
 4 files changed, 401 insertions(+), 629 deletions(-)
 create mode 100644 ipatests/test_xmlrpc/tracker/hostgroup_plugin.py

diff --git a/ipatests/test_xmlrpc/test_nesting.py b/ipatests/test_xmlrpc/test_nesting.py
index c3bf1ce84e0bef412c44ed847e7e0fc4648a4b74..f78a6e54bd7a94cb9d2645f5bdc5d5c109a79b1f 100644
--- a/ipatests/test_xmlrpc/test_nesting.py
+++ b/ipatests/test_xmlrpc/test_nesting.py
@@ -20,193 +20,93 @@
 Test group nesting and indirect members
 """
 
-from ipalib import api
-from ipatests.test_xmlrpc import objectclasses
-from ipatests.test_xmlrpc.xmlrpc_test import (Declarative, fuzzy_digits,
-  fuzzy_uuid)
-from ipapython.dn import DN
-from ipatests.test_xmlrpc.test_user_plugin import get_user_result
+from ipatests.test_xmlrpc.xmlrpc_test import XMLRPC_test
+from ipatests.test_xmlrpc.tracker.user_plugin import UserTracker
+from ipatests.test_xmlrpc.tracker.group_plugin import GroupTracker
+from ipatests.test_xmlrpc.tracker.host_plugin import HostTracker
+from ipatests.test_xmlrpc.tracker.hostgroup_plugin import HostGroupTracker
 import pytest
 
-group1 = u'testgroup1'
-group2 = u'testgroup2'
-group3 = u'testgroup3'
-group4 = u'testgroup4'
-user1 = u'tuser1'
-user2 = u'tuser2'
-user3 = u'tuser3'
-user4 = u'tuser4'
-
-hostgroup1 = u'testhostgroup1'
-hgdn1 = DN(('cn',hostgroup1),('cn','hostgroups'),('cn','accounts'),
-   api.env.basedn)
-hostgroup2 = u'testhostgroup2'
-hgdn2 = DN(('cn',hostgroup2),('cn','hostgroups'),('cn','accounts'),
-   api.env.basedn)
-
-fqdn1 = u'testhost1.%s' % api.env.domain
-host_dn1 = DN(('fqdn',fqdn1),('cn','computers'),('cn','accounts'),
-  api.env.basedn)
+
+@pytest.fixture(scope='class')
+def user1(request):
+tracker = UserTracker(name=u'tuser1', givenname=u'Test1', sn=u'User1')
+return tracker.make_fixture(request)
+
+
+@pytest.fixture(scope='class')
+def user2(request):
+tracker = UserTracker(name=u'tuser2', givenname=u'Test2', sn=u'User2')
+return tracker.make_fixture(request)
+
+
+@pytest.fixture(scope='class')
+def user3(request):
+tracker = UserTracker(name=u'tuser3', givenname=u'Test3', sn=u'User3')
+return tracker.make_fixture(request)
+
+
+@pytest.fixture(scope='class')
+def user4(request):
+tracker = UserTracker(name=u'tuser4', givenname=u'Test4', sn=u'User4')
+return tracker.make_fixture(request)
+
+
+@pytest.fixture(scope='class')
+def group1(request):
+tracker = GroupTracker(name=u'testgroup1', description=u'Test desc1')
+return tracker.make_fixture(request)
+
+
+@pytest.fixture(scope='class')
+def group2(request):
+tracker = GroupTracker(name=u'testgroup2', description=u'Test desc2')
+return tracker.make_fixture(request)
+
+
+@pytest.fixture(scope='class')
+def group3(request):
+tracker = GroupTracker(name=u'testgroup3', description=u'Test desc3')
+return tracker.make_fixture(request)
+
+
+@pytest.fixture(scope='class')
+def group4(request):
+tracker = GroupTracker(name=u'testgroup4', description=u'Test desc4')
+return tracker.make_fixture(request)
+
+
+@pytest.fixture(scope='class')
+def host1(request):
+tracker = HostTracker(name=u'ho

Re: [Freeipa-devel] [PATCH] 0008 Refactor test_sudocmdgroup_plugin, create SudoCmdGroupTracker

2016-02-24 Thread Filip Skola
Hi,

fixed. To be honest, I left that +1char longer lines there on purpose. IMHO it 
brings better readability and pep8 *.py | wc -l in test_xmlrpc dir returns an 
overwhelming number anyway. But yeah, some of these weren't really 
necessary...so I changed them all :)

This patch is dependent on 0007-3 patch.

Filip

- Original Message -
> NACK.
> 
> 
> [root@master2 test_xmlrpc]# pep8 test_sudocmdgroup_plugin.py
> test_sudocmdgroup_plugin.py:26:80: E501 line too long (80 > 79 characters)
> test_sudocmdgroup_plugin.py:70:80: E501 line too long (80 > 79 characters)
> test_sudocmdgroup_plugin.py:76:80: E501 line too long (80 > 79 characters)
> test_sudocmdgroup_plugin.py:84:80: E501 line too long (80 > 79 characters)
> test_sudocmdgroup_plugin.py:90:80: E501 line too long (80 > 79 characters)
> test_sudocmdgroup_plugin.py:98:80: E501 line too long (80 > 79 characters)
> test_sudocmdgroup_plugin.py:104:80: E501 line too long (80 > 79 characters)
> test_sudocmdgroup_plugin.py:166:80: E501 line too long (80 > 79 characters)
> test_sudocmdgroup_plugin.py:180:80: E501 line too long (80 > 79 characters)
> test_sudocmdgroup_plugin.py:186:80: E501 line too long (84 > 79 characters)
> [root@master2 test_xmlrpc]# pep8 tracker/sudocmdgroup_plugin.py
> tracker/sudocmdgroup_plugin.py:36:80: E501 line too long (82 > 79 characters)
> tracker/sudocmdgroup_plugin.py:42:80: E501 line too long (82 > 79 characters)
> tracker/sudocmdgroup_plugin.py:46:80: E501 line too long (85 > 79 characters)
> tracker/sudocmdgroup_plugin.py:55:80: E501 line too long (82 > 79 characters)
> tracker/sudocmdgroup_plugin.py:64:80: E501 line too long (82 > 79 characters)
> 
> 
> 
> - Original Message -
> > From: "Filip Skola" 
> > To: "Aleš Mareček" 
> > Cc: freeipa-devel@redhat.com, "Milan Kubík" 
> > Sent: Monday, February 22, 2016 3:41:36 PM
> > Subject: Re: [Freeipa-devel] [PATCH] 0008 Refactor
> > test_sudocmdgroup_plugin, create SudoCmdGroupTracker
> > 
> > Hi,
> > 
> > the test has been updated so it now uses the SudoCmdTracker (from the
> > previous patch).
> > 
> > Filip
> > 
> > - Original Message -
> > > NACK.
> > > 
> > > "create_sudocmd" and "delete_sudocmd" should be imported from Tracker,
> > > not
> > > from the previous test (sudocmd_plugin).
> > > 
> > >   - alich -
> > > 
> > > - Original Message -
> > > > From: "Filip Skola" 
> > > > To: freeipa-devel@redhat.com
> > > > Sent: Thursday, January 28, 2016 12:49:17 PM
> > > > Subject: [Freeipa-devel] [PATCH] 0008 Refactor
> > > > test_sudocmdgroup_plugin,
> > > > create SudoCmdGroupTracker
> > > > 
> > > > Hi,
> > > > 
> > > > sending the next sudo patch. This one depends on the previous one
> > > > (sudocmd_plugin).
> > > > 
> > > > Filip
> > > > 
> > > > --
> > > > 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 0fe52e2a9718a0aae5542e8bedc8d312dbc6e360 Mon Sep 17 00:00:00 2001
From: Filip Skola 
Date: Mon, 22 Feb 2016 14:21:56 +0100
Subject: [PATCH] Refactor test_sudocmdgroup_plugin

---
 ipatests/test_xmlrpc/test_sudocmdgroup_plugin.py   | 860 +
 .../test_xmlrpc/tracker/sudocmdgroup_plugin.py | 226 ++
 2 files changed, 415 insertions(+), 671 deletions(-)
 create mode 100644 ipatests/test_xmlrpc/tracker/sudocmdgroup_plugin.py

diff --git a/ipatests/test_xmlrpc/test_sudocmdgroup_plugin.py b/ipatests/test_xmlrpc/test_sudocmdgroup_plugin.py
index c72ba2f7a25d5b3c4817c7e17346a8ff5a324760..3f5879c4d90ed9872b9287344583892405bebff3 100644
--- a/ipatests/test_xmlrpc/test_sudocmdgroup_plugin.py
+++ b/ipatests/test_xmlrpc/test_sudocmdgroup_plugin.py
@@ -20,678 +20,196 @@
 Test the `ipalib/plugins/sudocmdgroup.py` module.
 """
 
-from ipalib import api, errors
-from ipatests.test_xmlrpc import objectclasses
-from ipatests.test_xmlrpc.xmlrpc_test import (Declarative, fuzzy_uuid,
-  fuzzy_sudocmddn)
-from ipapython.dn import DN
-import pytest
-
-sudocmdgroup1 = u'testsudocmdgroup1'
-sudocmdgroup2 = u'testsudocmdgroup2'
-sudocmd1 = u'/usr/bin/sudotestcmd1'
-sudocmd1_camelcase = u'/usr/bin/sudoTestCmd1'
-sudocmd_plus = u'/bin/ls -l /lost+found/*'
-
-def create_command(sudocmd):
-r

Re: [Freeipa-devel] [PATCH] 0007 Refactor test_sudocmd_plugin

2016-02-24 Thread Filip Skola
Hi,

these problems have been fixed.

F.

- Original Message -
> NACK.
> Some little changes still required:
>  * fixing the pep8 errors
>  * fixing the wrong comment
> 
> [root@master2 freeipa]# pep8 ipatests/test_xmlrpc/test_sudocmd_plugin.py
> ipatests/test_xmlrpc/test_sudocmd_plugin.py:94:80: E501 line too long (87 >
> 79 characters)
> ipatests/test_xmlrpc/test_sudocmd_plugin.py:97:80: E501 line too long (87 >
> 79 characters)
> ipatests/test_xmlrpc/test_sudocmd_plugin.py:134:80: E501 line too long (80 >
> 79 characters)
>   
> [root@master2 freeipa]# pep8 ipatests/test_xmlrpc/tracker/sudocmd_plugin.py
> ipatests/test_xmlrpc/tracker/sudocmd_plugin.py:14:80: E501 line too long (81
> > 79 characters)
> 
> [root@master2 freeipa]# grep 'Class for'
> ipatests/test_xmlrpc/tracker/sudocmd_plugin.py
> """ Class for host plugin like tests """
> 
> 
> - Original Message -
> > From: "Filip Skola" 
> > To: "Aleš Mareček" 
> > Cc: freeipa-devel@redhat.com, "Milan Kubík" 
> > Sent: Monday, February 22, 2016 1:59:43 PM
> > Subject: Re: [Freeipa-devel] [PATCH] 0007 Refactor test_sudocmd_plugin
> > 
> > Hi,
> > 
> > sudocmd tracker has been created.
> > 
> > Filip
> > 
> > - Original Message -
> > > NACK.
> > > 
> > > "create_sudocmd" and "delete_sudocmd" should be placed in Tracker. So
> > > this
> > > patch should create the tracker as well.
> > > 
> > > - Original Message -
> > > > From: "Filip Skola" 
> > > > To: freeipa-devel@redhat.com
> > > > Sent: Monday, January 25, 2016 3:57:25 PM
> > > > Subject: [Freeipa-devel] [PATCH] 0007 Refactor test_sudocmd_plugin
> > > > 
> > > > Hello,
> > > > 
> > > > attaching refactored sudocmd_plugin.
> > > > 
> > > > Filip
> > > > --
> > > > 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 1da1bdc46eb96b966e060b0ad83a3edebcc9c37b Mon Sep 17 00:00:00 2001
From: Filip Skola 
Date: Mon, 18 Jan 2016 13:56:44 +0100
Subject: [PATCH] Refactor test_sudocmd_plugin

---
 ipatests/test_xmlrpc/test_sudocmd_plugin.py| 448 +
 ipatests/test_xmlrpc/tracker/sudocmd_plugin.py | 113 +++
 2 files changed, 269 insertions(+), 292 deletions(-)
 create mode 100644 ipatests/test_xmlrpc/tracker/sudocmd_plugin.py

diff --git a/ipatests/test_xmlrpc/test_sudocmd_plugin.py b/ipatests/test_xmlrpc/test_sudocmd_plugin.py
index 2056118ba763be45e78ddf6643059e32d7680af8..7ffe7a1d0497ad9c755ccdbe057fee1a13523f20 100644
--- a/ipatests/test_xmlrpc/test_sudocmd_plugin.py
+++ b/ipatests/test_xmlrpc/test_sudocmd_plugin.py
@@ -21,309 +21,173 @@
 Test the `ipalib/plugins/sudocmd.py` module.
 """
 
-from ipalib import errors
-from ipatests.test_xmlrpc.xmlrpc_test import (Declarative, fuzzy_sudocmddn,
-fuzzy_uuid)
-from ipatests.test_xmlrpc import objectclasses
+from ipalib import api, errors
+from ipatests.util import assert_deepequal
+from ipatests.test_xmlrpc.xmlrpc_test import (XMLRPC_test, raises_exact)
+from ipatests.test_xmlrpc.tracker.sudocmd_plugin import SudoCmdTracker
 import pytest
 
-sudocmd1 = u'/usr/bin/sudotestcmd1'
-sudocmd1_camelcase = u'/usr/bin/sudoTestCmd1'
 
-sudorule1 = u'test_sudorule1'
+@pytest.fixture(scope='class')
+def sudocmd1(request):
+tracker = SudoCmdTracker(command=u'/usr/bin/sudotestcmd1',
+ description=u'Test sudo command 1')
+return tracker.make_fixture(request)
 
 
-@pytest.mark.tier1
-class test_sudocmd(Declarative):
-
-cleanup_commands = [
-('sudocmd_del', [sudocmd1], {}),
-('sudocmd_del', [sudocmd1_camelcase], {}),
-('sudorule_del', [sudorule1], {}),
-]
-
-tests = [
-
-dict(
-desc='Try to retrieve non-existent %r' % sudocmd1,
-command=('sudocmd_show', [sudocmd1], {}),
-expected=errors.NotFound(
-reason=u'%s: sudo command not found' % sudocmd1),
-),
-
-
-dict(
-desc='Try to update non-existent %r' % sudocmd1,
-command=('sudocmd_mod', [sudocmd1], dict(description=u'Nope')),
-expected=errors.NotFound(
-reason=u'%s: sudo command not found' % sudocmd1),
- 

Re: [Freeipa-devel] [PATCH] 0008 Refactor test_sudocmdgroup_plugin, create SudoCmdGroupTracker

2016-02-22 Thread Filip Skola
Hi,

the test has been updated so it now uses the SudoCmdTracker (from the previous 
patch).

Filip

- Original Message -
> NACK.
> 
> "create_sudocmd" and "delete_sudocmd" should be imported from Tracker, not
> from the previous test (sudocmd_plugin).
> 
>   - alich -
> 
> ----- Original Message -
> > From: "Filip Skola" 
> > To: freeipa-devel@redhat.com
> > Sent: Thursday, January 28, 2016 12:49:17 PM
> > Subject: [Freeipa-devel] [PATCH] 0008 Refactor test_sudocmdgroup_plugin,
> > create SudoCmdGroupTracker
> > 
> > Hi,
> > 
> > sending the next sudo patch. This one depends on the previous one
> > (sudocmd_plugin).
> > 
> > Filip
> > 
> > --
> > 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 023a89906d134b3141ac479e56ca64ccbda86801 Mon Sep 17 00:00:00 2001
From: Filip Skola 
Date: Mon, 22 Feb 2016 14:21:56 +0100
Subject: [PATCH] Refactor test_sudocmdgroup_plugin

---
 ipatests/test_xmlrpc/test_sudocmdgroup_plugin.py   | 849 +
 ipatests/test_xmlrpc/tracker/sudocmd_plugin.py |   2 +-
 .../test_xmlrpc/tracker/sudocmdgroup_plugin.py | 221 ++
 3 files changed, 401 insertions(+), 671 deletions(-)
 create mode 100644 ipatests/test_xmlrpc/tracker/sudocmdgroup_plugin.py

diff --git a/ipatests/test_xmlrpc/test_sudocmdgroup_plugin.py b/ipatests/test_xmlrpc/test_sudocmdgroup_plugin.py
index c72ba2f7a25d5b3c4817c7e17346a8ff5a324760..dfeef98fa936f0ca0fd75d1e2f1986bc5844ebc1 100644
--- a/ipatests/test_xmlrpc/test_sudocmdgroup_plugin.py
+++ b/ipatests/test_xmlrpc/test_sudocmdgroup_plugin.py
@@ -20,678 +20,187 @@
 Test the `ipalib/plugins/sudocmdgroup.py` module.
 """
 
-from ipalib import api, errors
-from ipatests.test_xmlrpc import objectclasses
-from ipatests.test_xmlrpc.xmlrpc_test import (Declarative, fuzzy_uuid,
-  fuzzy_sudocmddn)
-from ipapython.dn import DN
+from ipalib import errors
+from ipatests.test_xmlrpc.xmlrpc_test import XMLRPC_test, raises_exact
+from ipatests.test_xmlrpc.tracker.sudocmd_plugin import SudoCmdTracker
+from ipatests.test_xmlrpc.tracker.sudocmdgroup_plugin import SudoCmdGroupTracker
 import pytest
 
-sudocmdgroup1 = u'testsudocmdgroup1'
-sudocmdgroup2 = u'testsudocmdgroup2'
-sudocmd1 = u'/usr/bin/sudotestcmd1'
-sudocmd1_camelcase = u'/usr/bin/sudoTestCmd1'
-sudocmd_plus = u'/bin/ls -l /lost+found/*'
-
-def create_command(sudocmd):
-return dict(
-desc='Create %r' % sudocmd,
-command=(
-'sudocmd_add', [], dict(sudocmd=sudocmd,
-description=u'Test sudo command')
-),
-expected=dict(
-value=sudocmd,
-summary=u'Added Sudo Command "%s"' % sudocmd,
-result=dict(
-objectclass=objectclasses.sudocmd,
-sudocmd=[sudocmd],
-ipauniqueid=[fuzzy_uuid], description=[u'Test sudo command'],
-dn=fuzzy_sudocmddn,
-),
-),
-)
+
+@pytest.fixture(scope='class')
+def sudocmd1(request):
+tracker = SudoCmdTracker(command=u'/usr/bin/sudotestcmd1',
+ description=u'Test sudo command 1')
+return tracker.make_fixture(request)
+
+
+@pytest.fixture(scope='class')
+def sudocmd2(request):
+tracker = SudoCmdTracker(command=u'/usr/bin/sudoTestCmd1',
+ description=u'Test sudo command 2')
+return tracker.make_fixture(request)
+
+
+@pytest.fixture(scope='class')
+def sudocmd_plus(request):
+tracker = SudoCmdTracker(command=u'/bin/ls -l /lost+found/*',
+ description=u'Test sudo command 3')
+return tracker.make_fixture(request)
+
+
+@pytest.fixture(scope='class')
+def sudocmdgroup1(request):
+tracker = SudoCmdGroupTracker(u'testsudocmdgroup1', u'Test desc1')
+return tracker.make_fixture(request)
+
+
+@pytest.fixture(scope='class')
+def sudocmdgroup2(request):
+tracker = SudoCmdGroupTracker(u'testsudocmdgroup2', u'Test desc2')
+return tracker.make_fixture(request)
+
+
+@pytest.mark.tier1
+class TestSudoCmdGroupNonexistent(XMLRPC_test):
+def test_retrieve_nonexistent(self, sudocmdgroup1, sudocmdgroup2):
+""" Try to retrieve non-existent sudocmdgroups """
+sudocmdgroup1.ensure_missing()
+command = sudocmdgroup1.make_retrieve_command()
+with raises_exact(errors.NotFound(
+ 

Re: [Freeipa-devel] [PATCH] 0007 Refactor test_sudocmd_plugin

2016-02-22 Thread Filip Skola
Hi,

sudocmd tracker has been created.

Filip

- Original Message -
> NACK.
> 
> "create_sudocmd" and "delete_sudocmd" should be placed in Tracker. So this
> patch should create the tracker as well.
> 
> ----- Original Message -
> > From: "Filip Skola" 
> > To: freeipa-devel@redhat.com
> > Sent: Monday, January 25, 2016 3:57:25 PM
> > Subject: [Freeipa-devel] [PATCH] 0007 Refactor test_sudocmd_plugin
> > 
> > Hello,
> > 
> > attaching refactored sudocmd_plugin.
> > 
> > Filip
> > --
> > 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 bcb240e47afbf16524c341e1cd4ac621ccb1d3cf Mon Sep 17 00:00:00 2001
From: Filip Skola 
Date: Mon, 18 Jan 2016 13:56:44 +0100
Subject: [PATCH] Refactor test_sudocmd_plugin

---
 ipatests/test_xmlrpc/test_sudocmd_plugin.py| 446 +
 ipatests/test_xmlrpc/tracker/sudocmd_plugin.py | 112 +++
 2 files changed, 266 insertions(+), 292 deletions(-)
 create mode 100644 ipatests/test_xmlrpc/tracker/sudocmd_plugin.py

diff --git a/ipatests/test_xmlrpc/test_sudocmd_plugin.py b/ipatests/test_xmlrpc/test_sudocmd_plugin.py
index 2056118ba763be45e78ddf6643059e32d7680af8..74340e4b8b5335e20f0f4c6e1ec0b698232b0ea9 100644
--- a/ipatests/test_xmlrpc/test_sudocmd_plugin.py
+++ b/ipatests/test_xmlrpc/test_sudocmd_plugin.py
@@ -21,309 +21,171 @@
 Test the `ipalib/plugins/sudocmd.py` module.
 """
 
-from ipalib import errors
-from ipatests.test_xmlrpc.xmlrpc_test import (Declarative, fuzzy_sudocmddn,
-fuzzy_uuid)
-from ipatests.test_xmlrpc import objectclasses
+from ipalib import api, errors
+from ipatests.util import assert_deepequal
+from ipatests.test_xmlrpc.xmlrpc_test import (XMLRPC_test, raises_exact)
+from ipatests.test_xmlrpc.tracker.sudocmd_plugin import SudoCmdTracker
 import pytest
 
-sudocmd1 = u'/usr/bin/sudotestcmd1'
-sudocmd1_camelcase = u'/usr/bin/sudoTestCmd1'
 
-sudorule1 = u'test_sudorule1'
+@pytest.fixture(scope='class')
+def sudocmd1(request):
+tracker = SudoCmdTracker(command=u'/usr/bin/sudotestcmd1',
+ description=u'Test sudo command 1')
+return tracker.make_fixture(request)
 
 
-@pytest.mark.tier1
-class test_sudocmd(Declarative):
-
-cleanup_commands = [
-('sudocmd_del', [sudocmd1], {}),
-('sudocmd_del', [sudocmd1_camelcase], {}),
-('sudorule_del', [sudorule1], {}),
-]
-
-tests = [
-
-dict(
-desc='Try to retrieve non-existent %r' % sudocmd1,
-command=('sudocmd_show', [sudocmd1], {}),
-expected=errors.NotFound(
-reason=u'%s: sudo command not found' % sudocmd1),
-),
-
-
-dict(
-desc='Try to update non-existent %r' % sudocmd1,
-command=('sudocmd_mod', [sudocmd1], dict(description=u'Nope')),
-expected=errors.NotFound(
-reason=u'%s: sudo command not found' % sudocmd1),
-),
-
-
-dict(
-desc='Try to delete non-existent %r' % sudocmd1,
-command=('sudocmd_del', [sudocmd1], {}),
-expected=errors.NotFound(
-reason=u'%s: sudo command not found' % sudocmd1),
-),
-
-
-dict(
-desc='Create %r' % sudocmd1,
-command=('sudocmd_add', [sudocmd1],
-dict(
-description=u'Test sudo command 1',
-),
-),
-expected=dict(
-value=sudocmd1,
-summary=u'Added Sudo Command "%s"' % sudocmd1,
-result=dict(
-dn=fuzzy_sudocmddn,
-sudocmd=[sudocmd1],
-description=[u'Test sudo command 1'],
-objectclass=objectclasses.sudocmd,
-ipauniqueid=[fuzzy_uuid],
-),
-),
-),
-
-dict(
-desc='Create %r' % sudocmd1_camelcase,
-command=('sudocmd_add', [sudocmd1_camelcase],
-dict(
-description=u'Test sudo command 2',
-),
-),
-expected=dict(
-value=sudocmd1_camelcase,
-summary=u'Added Sudo Command "%s"' % sudocmd1_camelcase,
-result=dict(
-dn=fuzzy_sudocmddn,
-sudocmd=[sudocmd1_camelcase],
-description=[u'Test sudo command 2&

Re: [Freeipa-devel] [PATCH 0002] Refactor test_group_plugin

2016-02-22 Thread Filip Skola


- Original Message -
> On 02/10/2016 09:17 AM, Milan Kubík wrote:
> > On 02/09/2016 04:19 PM, Milan Kubík wrote:
> >> On 01/28/2016 10:42 AM, Filip Skola wrote:
> >>>
> >>> - Original Message -
> >>>> On 01/25/2016 11:11 AM, Filip Skola wrote:
> >>>>> - Original Message -
> >>>>>> On 01/15/2016 03:38 PM, Filip Skola wrote:
> >>>>>>> Hi,
> >>>>>>>
> >>>>>>> sending rebased patch.
> >>>>>>>
> >>>>>>> F.
> >>>>>>>
> >>>>>>> - Original Message -
> >>>>>>>> Hello,
> >>>>>>>>
> >>>>>>>> sorry for delays. The patch no longer applies to master. Rebase
> >>>>>>>> it,
> >>>>>>>> please.
> >>>>>>>>
> >>>>>>>> Milan
> >>>>>>>>
> >>>>>>>> - Original Message -
> >>>>>>>> From: "Filip Škola" 
> >>>>>>>> To: "Milan Kubík" 
> >>>>>>>> Cc: freeipa-devel@redhat.com
> >>>>>>>> Sent: Wednesday, 9 December, 2015 7:01:02 PM
> >>>>>>>> Subject: Re: [Freeipa-devel] [PATCH 0002] Refactor
> >>>>>>>> test_group_plugin
> >>>>>>>>
> >>>>>>>> On Mon, 7 Dec 2015 17:49:18 +0100
> >>>>>>>> Milan Kubík  wrote:
> >>>>>>>>
> >>>>>>>>> On 12/03/2015 08:15 PM, Filip Škola wrote:
> >>>>>>>>>> On Mon, 30 Nov 2015 17:18:30 +0100
> >>>>>>>>>> Milan Kubík  wrote:
> >>>>>>>>>>
> >>>>>>>>>>> On 11/23/2015 04:42 PM, Filip Škola wrote:
> >>>>>>>>>>>> Sending updated patch.
> >>>>>>>>>>>>
> >>>>>>>>>>>> F.
> >>>>>>>>>>>>
> >>>>>>>>>>>> On Mon, 23 Nov 2015 14:59:34 +0100
> >>>>>>>>>>>> Filip Škola  wrote:
> >>>>>>>>>>>>
> >>>>>>>>>>>>> Found couple of issues (broke some dependencies).
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> NACK
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> F.
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> On Fri, 20 Nov 2015 13:56:36 +0100
> >>>>>>>>>>>>> Filip Škola  wrote:
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>> Another one.
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> F.
> >>>>>>>>>>> Hi, the tests look good. Few remarks, though.
> >>>>>>>>>>>
> >>>>>>>>>>> 1. Please, use the shortes copyright notice in new modules.
> >>>>>>>>>>>
> >>>>>>>>>>>  #
> >>>>>>>>>>>  # Copyright (C) 2015  FreeIPA Contributors see
> >>>>>>>>>>> COPYING for
> >>>>>>>>>>> license #
> >>>>>>>>>>>
> >>>>>>>>>>> 2. The tests `test_group_remove_group_from_protected_group` and
> >>>>>>>>>>> `test_group_full_set_of_objectclass_not_available_post_detach`
> >>>>>>>>>>> were not ported. Please, include them in the patch.
> >>>>>>>>>>>
> >>>>>>>>>>> Also, for less hassle, please rebase your patches on top of
> >>>>>>>>>>> freeipa-mkubik-0025-3-Separated-Tracker-implementations-into-standalone-pa.patch
> >>>>>>>>>>>
> >>>>>>>>>>> Which changes the location of tracker implementations and
> >>>>>>>>>>> preven

[Freeipa-devel] [PATCH] 0008 Refactor test_sudocmdgroup_plugin, create SudoCmdGroupTracker

2016-01-28 Thread Filip Skola
Hi,

sending the next sudo patch. This one depends on the previous one 
(sudocmd_plugin).

Filip
From 9aab785cf39233998f42917b10cab3ef976f91f1 Mon Sep 17 00:00:00 2001
From: Filip Skola 
Date: Thu, 28 Jan 2016 11:57:08 +0100
Subject: [PATCH] Refactor test_sudocmdgroup_plugin, create SudoCmdGroupTracker

---
 ipatests/test_xmlrpc/test_sudocmdgroup_plugin.py   | 854 +
 .../test_xmlrpc/tracker/sudocmdgroup_plugin.py | 234 ++
 2 files changed, 433 insertions(+), 655 deletions(-)
 create mode 100644 ipatests/test_xmlrpc/tracker/sudocmdgroup_plugin.py

diff --git a/ipatests/test_xmlrpc/test_sudocmdgroup_plugin.py b/ipatests/test_xmlrpc/test_sudocmdgroup_plugin.py
index c72ba2f7a25d5b3c4817c7e17346a8ff5a324760..74575e2c846dcdc6db29f1bab454543da8e5d856 100644
--- a/ipatests/test_xmlrpc/test_sudocmdgroup_plugin.py
+++ b/ipatests/test_xmlrpc/test_sudocmdgroup_plugin.py
@@ -21,677 +21,221 @@ Test the `ipalib/plugins/sudocmdgroup.py` module.
 """
 
 from ipalib import api, errors
-from ipatests.test_xmlrpc import objectclasses
-from ipatests.test_xmlrpc.xmlrpc_test import (Declarative, fuzzy_uuid,
-  fuzzy_sudocmddn)
-from ipapython.dn import DN
+from ipatests.util import assert_deepequal
+from ipatests.test_xmlrpc.xmlrpc_test import (XMLRPC_test, fuzzy_sudocmddn,
+  raises_exact)
+from ipatests.test_xmlrpc.tracker.sudocmdgroup_plugin import SudoCmdGroupTracker
+from ipatests.test_xmlrpc.test_sudocmd_plugin import create_sudocmd, delete_sudocmd
 import pytest
 
-sudocmdgroup1 = u'testsudocmdgroup1'
-sudocmdgroup2 = u'testsudocmdgroup2'
-sudocmd1 = u'/usr/bin/sudotestcmd1'
-sudocmd1_camelcase = u'/usr/bin/sudoTestCmd1'
-sudocmd_plus = u'/bin/ls -l /lost+found/*'
-
-def create_command(sudocmd):
-return dict(
-desc='Create %r' % sudocmd,
-command=(
-'sudocmd_add', [], dict(sudocmd=sudocmd,
-description=u'Test sudo command')
-),
-expected=dict(
-value=sudocmd,
-summary=u'Added Sudo Command "%s"' % sudocmd,
-result=dict(
-objectclass=objectclasses.sudocmd,
-sudocmd=[sudocmd],
-ipauniqueid=[fuzzy_uuid], description=[u'Test sudo command'],
-dn=fuzzy_sudocmddn,
-),
-),
-)
 
+sudocmd1_desc = u'Test sudo command 1'
+sudocmd2_desc = u'Test sudo command 2'
+sudocmd_plus_desc = u'Test sudo command 3'
 
-@pytest.mark.tier1
-class test_sudocmdgroup(Declarative):
-cleanup_commands = [
-('sudocmdgroup_del', [sudocmdgroup1], {}),
-('sudocmdgroup_del', [sudocmdgroup2], {}),
-('sudocmd_del', [sudocmd1], {}),
-('sudocmd_del', [sudocmd1_camelcase], {}),
-('sudocmd_del', [sudocmd_plus], {}),
-]
-
-tests = [
-
-
-# create sudo command
-dict(
-desc='Create %r' % sudocmd1,
-command=(
-'sudocmd_add', [], dict(sudocmd=sudocmd1, description=u'Test sudo command 1')
-),
-expected=dict(
-value=sudocmd1,
-summary=u'Added Sudo Command "%s"' % sudocmd1,
-result=dict(
-objectclass=objectclasses.sudocmd,
-sudocmd=[u'/usr/bin/sudotestcmd1'],
-ipauniqueid=[fuzzy_uuid],
-description=[u'Test sudo command 1'],
-dn=fuzzy_sudocmddn,
-),
-),
-),
-
-dict(
-desc='Create %r' % sudocmd1_camelcase,
-command=(
-'sudocmd_add', [], dict(sudocmd=sudocmd1_camelcase, description=u'Test sudo command 2')
-),
-expected=dict(
-value=sudocmd1_camelcase,
-summary=u'Added Sudo Command "%s"' % sudocmd1_camelcase,
-result=dict(
-objectclass=objectclasses.sudocmd,
-sudocmd=[u'/usr/bin/sudoTestCmd1'],
-ipauniqueid=[fuzzy_uuid],
-description=[u'Test sudo command 2'],
-dn=fuzzy_sudocmddn,
-),
-),
-),
 
-dict(
-desc='Verify the managed sudo command %r was created' % sudocmd1,
-command=('sudocmd_show', [sudocmd1], {}),
-expected=dict(
-value=sudocmd1,
-summary=None,
-result=dict(
-sudocmd=[sudocmd1],
-d

Re: [Freeipa-devel] [PATCH 0005] Refactor test_nesting, create HostGroupTracker

2016-01-28 Thread Filip Skola


- Original Message -
> On 01/18/2016 02:26 PM, Filip Skola wrote:
> > Hi,
> >
> > this should be fixed in this patch.
> >
> > F.
> >
> > - Original Message -
> >> On 01/15/2016 03:37 PM, Filip Skola wrote:
> >>> Hi,
> >>>
> >>> sending rebased patch.
> >>>
> >>> F.
> >>>
> >>> - Original Message -
> >>>> Hi,
> >>>>
> >>>> the patch no longer applies to master. Please rebase it.
> >>>>
> >>>> Thanks,
> >>>> Milan
> >>>>
> >>>> - Original Message -
> >>>> From: "Filip Skola" 
> >>>> To: freeipa-devel@redhat.com
> >>>> Cc: "Milan Kubík" , "Aleš Mareček"
> >>>> 
> >>>> Sent: Tuesday, 22 December, 2015 11:56:15 AM
> >>>> Subject: [PATCH 0005] Refactor test_nesting, create HostGroupTracker
> >>>>
> >>>> Hi,
> >>>>
> >>>> another patch from refactoring-test_xmlrpc series.
> >>>>
> >>>> Filip
> >>>>
> >> NACK, something seems to be missing in the patch
> >>
> >>
> >> * Module ipatests.test_xmlrpc.tracker.hostgroup_plugin
> >> ipatests/test_xmlrpc/tracker/hostgroup_plugin.py:222: [E1101(no-member),
> >> HostGroupTracker.check_add_member_negative] Instance of
> >> 'HostGroupTracker' has no 'adds' member)
> >>
> >> --
> >> Milan Kubik
> >>
> >>
> The same as with patch 0002:
> * Module ipatests.test_xmlrpc.tracker.hostgroup_plugin
> W:142,26: Calling a dict.iter*() method (dict-iter-method)
> 
> Please use dict.items method.
> 
> --
> Milan Kubik
> 
> 

Hi,

attaching a fixed patch. This patch is dependent on updated group plugin test 
patch 0002-7.

Filip
From 5dee3969a039241411ec1648d9ba1b87c149ccf3 Mon Sep 17 00:00:00 2001
From: Filip Skola 
Date: Thu, 28 Jan 2016 10:29:04 +0100
Subject: [PATCH] Refactor test_nesting, create HostGroupTracker

---
 ipatests/test_xmlrpc/test_nesting.py   | 776 -
 ipatests/test_xmlrpc/tracker/group_plugin.py   |   4 +-
 ipatests/test_xmlrpc/tracker/host_plugin.py|   1 +
 .../{group_plugin.py => hostgroup_plugin.py}   | 227 +++---
 4 files changed, 259 insertions(+), 749 deletions(-)
 copy ipatests/test_xmlrpc/tracker/{group_plugin.py => hostgroup_plugin.py} (51%)

diff --git a/ipatests/test_xmlrpc/test_nesting.py b/ipatests/test_xmlrpc/test_nesting.py
index c3bf1ce84e0bef412c44ed847e7e0fc4648a4b74..f78a6e54bd7a94cb9d2645f5bdc5d5c109a79b1f 100644
--- a/ipatests/test_xmlrpc/test_nesting.py
+++ b/ipatests/test_xmlrpc/test_nesting.py
@@ -20,193 +20,93 @@
 Test group nesting and indirect members
 """
 
-from ipalib import api
-from ipatests.test_xmlrpc import objectclasses
-from ipatests.test_xmlrpc.xmlrpc_test import (Declarative, fuzzy_digits,
-  fuzzy_uuid)
-from ipapython.dn import DN
-from ipatests.test_xmlrpc.test_user_plugin import get_user_result
+from ipatests.test_xmlrpc.xmlrpc_test import XMLRPC_test
+from ipatests.test_xmlrpc.tracker.user_plugin import UserTracker
+from ipatests.test_xmlrpc.tracker.group_plugin import GroupTracker
+from ipatests.test_xmlrpc.tracker.host_plugin import HostTracker
+from ipatests.test_xmlrpc.tracker.hostgroup_plugin import HostGroupTracker
 import pytest
 
-group1 = u'testgroup1'
-group2 = u'testgroup2'
-group3 = u'testgroup3'
-group4 = u'testgroup4'
-user1 = u'tuser1'
-user2 = u'tuser2'
-user3 = u'tuser3'
-user4 = u'tuser4'
-
-hostgroup1 = u'testhostgroup1'
-hgdn1 = DN(('cn',hostgroup1),('cn','hostgroups'),('cn','accounts'),
-   api.env.basedn)
-hostgroup2 = u'testhostgroup2'
-hgdn2 = DN(('cn',hostgroup2),('cn','hostgroups'),('cn','accounts'),
-   api.env.basedn)
-
-fqdn1 = u'testhost1.%s' % api.env.domain
-host_dn1 = DN(('fqdn',fqdn1),('cn','computers'),('cn','accounts'),
-  api.env.basedn)
+
+@pytest.fixture(scope='class')
+def user1(request):
+tracker = UserTracker(name=u'tuser1', givenname=u'Test1', sn=u'User1')
+return tracker.make_fixture(request)
+
+
+@pytest.fixture(scope='class')
+def user2(request):
+tracker = UserTracker(name=u'tuser2', givenname=u'Test2', sn=u

Re: [Freeipa-devel] [PATCH 0002] Refactor test_group_plugin

2016-01-28 Thread Filip Skola


- Original Message -
> On 01/25/2016 11:11 AM, Filip Skola wrote:
> >
> > - Original Message -
> >> On 01/15/2016 03:38 PM, Filip Skola wrote:
> >>> Hi,
> >>>
> >>> sending rebased patch.
> >>>
> >>> F.
> >>>
> >>> - Original Message -
> >>>> Hello,
> >>>>
> >>>> sorry for delays. The patch no longer applies to master. Rebase it,
> >>>> please.
> >>>>
> >>>> Milan
> >>>>
> >>>> - Original Message -
> >>>> From: "Filip Škola" 
> >>>> To: "Milan Kubík" 
> >>>> Cc: freeipa-devel@redhat.com
> >>>> Sent: Wednesday, 9 December, 2015 7:01:02 PM
> >>>> Subject: Re: [Freeipa-devel] [PATCH 0002] Refactor test_group_plugin
> >>>>
> >>>> On Mon, 7 Dec 2015 17:49:18 +0100
> >>>> Milan Kubík  wrote:
> >>>>
> >>>>> On 12/03/2015 08:15 PM, Filip Škola wrote:
> >>>>>> On Mon, 30 Nov 2015 17:18:30 +0100
> >>>>>> Milan Kubík  wrote:
> >>>>>>
> >>>>>>> On 11/23/2015 04:42 PM, Filip Škola wrote:
> >>>>>>>> Sending updated patch.
> >>>>>>>>
> >>>>>>>> F.
> >>>>>>>>
> >>>>>>>> On Mon, 23 Nov 2015 14:59:34 +0100
> >>>>>>>> Filip Škola  wrote:
> >>>>>>>>
> >>>>>>>>> Found couple of issues (broke some dependencies).
> >>>>>>>>>
> >>>>>>>>> NACK
> >>>>>>>>>
> >>>>>>>>> F.
> >>>>>>>>>
> >>>>>>>>> On Fri, 20 Nov 2015 13:56:36 +0100
> >>>>>>>>> Filip Škola  wrote:
> >>>>>>>>>
> >>>>>>>>>> Another one.
> >>>>>>>>>>
> >>>>>>>>>> F.
> >>>>>>> Hi, the tests look good. Few remarks, though.
> >>>>>>>
> >>>>>>> 1. Please, use the shortes copyright notice in new modules.
> >>>>>>>
> >>>>>>> #
> >>>>>>> # Copyright (C) 2015  FreeIPA Contributors see COPYING for
> >>>>>>> license #
> >>>>>>>
> >>>>>>> 2. The tests `test_group_remove_group_from_protected_group` and
> >>>>>>> `test_group_full_set_of_objectclass_not_available_post_detach`
> >>>>>>> were not ported. Please, include them in the patch.
> >>>>>>>
> >>>>>>> Also, for less hassle, please rebase your patches on top of
> >>>>>>> freeipa-mkubik-0025-3-Separated-Tracker-implementations-into-standalone-pa.patch
> >>>>>>> Which changes the location of tracker implementations and prevents
> >>>>>>> circular imports.
> >>>>>>>
> >>>>>>> Thanks.
> >>>>>>>
> >>>>>> Hi,
> >>>>>>
> >>>>>> these cases are there, in corresponding classes. They are marked
> >>>>>> with the original comments. (However I can move them to separate
> >>>>>> class if desirable.)
> >>>>>>
> >>>>>> The copyright notice is changed. Also included a few changes in the
> >>>>>> test with user without private group.
> >>>>>>
> >>>>>> Filip
> >>>>> NACK
> >>>>>
> >>>>> linter:
> >>>>> * Module tracker.group_plugin
> >>>>> ipatests/test_xmlrpc/tracker/group_plugin.py:257:
> >>>>> [E0102(function-redefined), GroupTracker.check_remove_member] method
> >>>>> already defined line 253)
> >>>>>
> >>>>> Probably a leftover after the rebase made on top of my patch. Please
> >>>>> fix it. You can check youch changes by make-lint script before
> >>>>> sending them.
> >>>>>
> >>>>> Thanks
> >>>>>
> >>>> Hi,
> >>>>
> >&

[Freeipa-devel] [PATCH] 0007 Refactor test_sudocmd_plugin

2016-01-25 Thread Filip Skola
Hello,

attaching refactored sudocmd_plugin.

FilipFrom ad926d3a9bdf4fae2504c60e0facb26485f91941 Mon Sep 17 00:00:00 2001
From: Filip Skola 
Date: Mon, 18 Jan 2016 13:56:44 +0100
Subject: [PATCH] Refactor test_sudocmd_plugin

---
 ipatests/test_xmlrpc/test_sudocmd_plugin.py | 561 +---
 1 file changed, 262 insertions(+), 299 deletions(-)

diff --git a/ipatests/test_xmlrpc/test_sudocmd_plugin.py b/ipatests/test_xmlrpc/test_sudocmd_plugin.py
index 2056118ba763be45e78ddf6643059e32d7680af8..bf056a606248d001889af3ee8d9dcec7118be502 100644
--- a/ipatests/test_xmlrpc/test_sudocmd_plugin.py
+++ b/ipatests/test_xmlrpc/test_sudocmd_plugin.py
@@ -21,309 +21,272 @@
 Test the `ipalib/plugins/sudocmd.py` module.
 """
 
-from ipalib import errors
-from ipatests.test_xmlrpc.xmlrpc_test import (Declarative, fuzzy_sudocmddn,
-fuzzy_uuid)
+from ipalib import api, errors
+from ipatests.util import assert_deepequal
+from ipatests.test_xmlrpc.xmlrpc_test import (XMLRPC_test, fuzzy_sudocmddn,
+  fuzzy_uuid, raises_exact)
 from ipatests.test_xmlrpc import objectclasses
+from nose.tools import raises
 import pytest
 
-sudocmd1 = u'/usr/bin/sudotestcmd1'
-sudocmd1_camelcase = u'/usr/bin/sudoTestCmd1'
 
-sudorule1 = u'test_sudorule1'
+sudocmd_nonexistent = u'testing_sudocmd'
+sudocmd1_desc = u'Test sudo command 1'
+sudocmd2_desc = u'Test sudo command 2'
+
+
+def create_sudocmd(command, description):
+""" Create sudocmd and check the result """
+result = api.Command['sudocmd_add'](
+command, description=description
+)
+assert_deepequal(dict(
+value=command,
+summary=u'Added Sudo Command "%s"' % command,
+result=dict(
+dn=fuzzy_sudocmddn,
+sudocmd=[command],
+description=[description],
+objectclass=objectclasses.sudocmd,
+ipauniqueid=[fuzzy_uuid])),
+result)
+
+
+def delete_sudocmd(command):
+""" Delete sudocmd and check the result """
+result = api.Command['sudocmd_del'](command)
+assert_deepequal(dict(
+value=[command],
+summary=u'Deleted Sudo Command "%s"' % command,
+result=dict(failed=[])),
+result)
+
+
+@pytest.fixture(scope='class')
+def sudocmd1(request):
+command = u'/usr/bin/sudotestcmd1'
+description = sudocmd1_desc
+create_sudocmd(command, description)
+
+def fin():
+delete_sudocmd(command)
+request.addfinalizer(fin)
+return command
+
+
+@pytest.fixture(scope='class')
+def sudocmd2(request):
+command = u'/usr/bin/sudoTestCmd1'
+description = sudocmd2_desc
+create_sudocmd(command, description)
+
+def fin():
+delete_sudocmd(command)
+request.addfinalizer(fin)
+return command
+
+
+@pytest.fixture(scope='class')
+def sudorule1(request):
+name = u'test_sudorule1'
+
+def fin():
+api.Command['sudorule_del'](name)
+request.addfinalizer(fin)
+return name
+
+
+@pytest.mark.tier1
+class TestNonexistentSudoCmd(XMLRPC_test):
+@raises(errors.NotFound)
+def test_retrieve_nonexistent(self):
+""" Try to retrieve non-existent sudocmd """
+api.Command['sudocmd_show'](sudocmd_nonexistent)
+
+@raises(errors.NotFound)
+def test_update_nonexistent(self):
+""" Try to update non-existent sudocmd """
+api.Command['sudocmd_mod'](sudocmd_nonexistent, description=u'Nope')
+
+@raises(errors.NotFound)
+def test_delete_nonexistent(self):
+""" Try to delete non-existent sudocmd """
+api.Command['sudocmd_del'](sudocmd_nonexistent)
+
+
+@pytest.mark.tier1
+class TestSudoCmd(XMLRPC_test):
+def test_create(self, sudocmd1, sudocmd2):
+""" Create sudocmd and sudocmd with camelcase'd command """
+# sudocmds get created by the fixtures
+
+def test_create_duplicate(self, sudocmd1):
+""" Try to create duplicate sudocmd """
+with raises_exact(errors.DuplicateEntry(
+message=u'sudo command with name "%s" already exists' % sudocmd1)):
+create_sudocmd(sudocmd1, '')
+
+def test_create_duplicate_camelcase(self, sudocmd2):
+""" Try to create duplicate camelcase'd sudocmd """
+with raises_exact(errors.DuplicateEntry(
+message=u'sudo command with name "%s" already exists' % sudocmd2)):
+create_sudocmd(sudocmd2, '')
+
+def test_

Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin

2016-01-25 Thread Filip Skola


- 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 0002] Refactor test_group_plugin

2016-01-25 Thread Filip Skola


- Original Message -
> On 01/15/2016 03:38 PM, Filip Skola wrote:
> > Hi,
> >
> > sending rebased patch.
> >
> > F.
> >
> > - Original Message -
> >> Hello,
> >>
> >> sorry for delays. The patch no longer applies to master. Rebase it,
> >> please.
> >>
> >> Milan
> >>
> >> - Original Message -
> >> From: "Filip Škola" 
> >> To: "Milan Kubík" 
> >> Cc: freeipa-devel@redhat.com
> >> Sent: Wednesday, 9 December, 2015 7:01:02 PM
> >> Subject: Re: [Freeipa-devel] [PATCH 0002] Refactor test_group_plugin
> >>
> >> On Mon, 7 Dec 2015 17:49:18 +0100
> >> Milan Kubík  wrote:
> >>
> >>> On 12/03/2015 08:15 PM, Filip Škola wrote:
> >>>> On Mon, 30 Nov 2015 17:18:30 +0100
> >>>> Milan Kubík  wrote:
> >>>>
> >>>>> On 11/23/2015 04:42 PM, Filip Škola wrote:
> >>>>>> Sending updated patch.
> >>>>>>
> >>>>>> F.
> >>>>>>
> >>>>>> On Mon, 23 Nov 2015 14:59:34 +0100
> >>>>>> Filip Škola  wrote:
> >>>>>>
> >>>>>>> Found couple of issues (broke some dependencies).
> >>>>>>>
> >>>>>>> NACK
> >>>>>>>
> >>>>>>> F.
> >>>>>>>
> >>>>>>> On Fri, 20 Nov 2015 13:56:36 +0100
> >>>>>>> Filip Škola  wrote:
> >>>>>>>
> >>>>>>>> Another one.
> >>>>>>>>
> >>>>>>>> F.
> >>>>> Hi, the tests look good. Few remarks, though.
> >>>>>
> >>>>> 1. Please, use the shortes copyright notice in new modules.
> >>>>>
> >>>>>#
> >>>>># Copyright (C) 2015  FreeIPA Contributors see COPYING for
> >>>>> license #
> >>>>>
> >>>>> 2. The tests `test_group_remove_group_from_protected_group` and
> >>>>> `test_group_full_set_of_objectclass_not_available_post_detach`
> >>>>> were not ported. Please, include them in the patch.
> >>>>>
> >>>>> Also, for less hassle, please rebase your patches on top of
> >>>>> freeipa-mkubik-0025-3-Separated-Tracker-implementations-into-standalone-pa.patch
> >>>>> Which changes the location of tracker implementations and prevents
> >>>>> circular imports.
> >>>>>
> >>>>> Thanks.
> >>>>>
> >>>>
> >>>> Hi,
> >>>>
> >>>> these cases are there, in corresponding classes. They are marked
> >>>> with the original comments. (However I can move them to separate
> >>>> class if desirable.)
> >>>>
> >>>> The copyright notice is changed. Also included a few changes in the
> >>>> test with user without private group.
> >>>>
> >>>> Filip
> >>> NACK
> >>>
> >>> linter:
> >>> * Module tracker.group_plugin
> >>> ipatests/test_xmlrpc/tracker/group_plugin.py:257:
> >>> [E0102(function-redefined), GroupTracker.check_remove_member] method
> >>> already defined line 253)
> >>>
> >>> Probably a leftover after the rebase made on top of my patch. Please
> >>> fix it. You can check youch changes by make-lint script before
> >>> sending them.
> >>>
> >>> Thanks
> >>>
> >>
> >> Hi,
> >>
> >> I learned to use make-lint!
> >>
> >> Thanks,
> >> F.
> >>
> Hello,
> 
> NACK, pylint doesn't seem to like the way the fixtures are imported
> (pytest does a lot of runtime magic) [1].
> One possible solution would be [2]. Though, I don't think this would be
> a good idea in our environment. I suggest to create the fixtures on per
> module basis.
> 
> 
> [1]: http://fpaste.org/311949/53118942/
> [2]:
> https://pytest.org/latest/fixture.html#using-fixtures-from-classes-modules-or-projects
> 
> --
> Milan Kubik
> 
> 

Hi,

the fixtures were copied into corresponding module. Please note that this patch 
has a dependence on my patch 0001 (user plugin).

FilipFrom d0f1815a2df4a98354cdd73360fe8e861368c0f3 Mon

Re: [Freeipa-devel] [PATCH 0005] Refactor test_nesting, create HostGroupTracker

2016-01-18 Thread Filip Skola
Hi,

this should be fixed in this patch.

F.

- Original Message -
> On 01/15/2016 03:37 PM, Filip Skola wrote:
> > Hi,
> >
> > sending rebased patch.
> >
> > F.
> >
> > - Original Message -
> >> Hi,
> >>
> >> the patch no longer applies to master. Please rebase it.
> >>
> >> Thanks,
> >> Milan
> >>
> >> - Original Message -
> >> From: "Filip Skola" 
> >> To: freeipa-devel@redhat.com
> >> Cc: "Milan Kubík" , "Aleš Mareček"
> >> 
> >> Sent: Tuesday, 22 December, 2015 11:56:15 AM
> >> Subject: [PATCH 0005] Refactor test_nesting, create HostGroupTracker
> >>
> >> Hi,
> >>
> >> another patch from refactoring-test_xmlrpc series.
> >>
> >> Filip
> >>
> NACK, something seems to be missing in the patch
> 
> 
> * Module ipatests.test_xmlrpc.tracker.hostgroup_plugin
> ipatests/test_xmlrpc/tracker/hostgroup_plugin.py:222: [E1101(no-member),
> HostGroupTracker.check_add_member_negative] Instance of
> 'HostGroupTracker' has no 'adds' member)
> 
> --
> Milan Kubik
> 
> 
From ed2fd7dbc301ada9ed35452832418b520d27f6e8 Mon Sep 17 00:00:00 2001
From: Filip Skola 
Date: Fri, 15 Jan 2016 15:08:46 +0100
Subject: [PATCH] Refactor test_nesting, create HostGroupTracker

---
 ipatests/test_xmlrpc/test_nesting.py   | 776 -
 ipatests/test_xmlrpc/tracker/group_plugin.py   |   4 +-
 ipatests/test_xmlrpc/tracker/host_plugin.py|   1 +
 .../{group_plugin.py => hostgroup_plugin.py}   | 225 +++---
 4 files changed, 258 insertions(+), 748 deletions(-)
 copy ipatests/test_xmlrpc/tracker/{group_plugin.py => hostgroup_plugin.py} (51%)

diff --git a/ipatests/test_xmlrpc/test_nesting.py b/ipatests/test_xmlrpc/test_nesting.py
index c3bf1ce84e0bef412c44ed847e7e0fc4648a4b74..f78a6e54bd7a94cb9d2645f5bdc5d5c109a79b1f 100644
--- a/ipatests/test_xmlrpc/test_nesting.py
+++ b/ipatests/test_xmlrpc/test_nesting.py
@@ -20,193 +20,93 @@
 Test group nesting and indirect members
 """
 
-from ipalib import api
-from ipatests.test_xmlrpc import objectclasses
-from ipatests.test_xmlrpc.xmlrpc_test import (Declarative, fuzzy_digits,
-  fuzzy_uuid)
-from ipapython.dn import DN
-from ipatests.test_xmlrpc.test_user_plugin import get_user_result
+from ipatests.test_xmlrpc.xmlrpc_test import XMLRPC_test
+from ipatests.test_xmlrpc.tracker.user_plugin import UserTracker
+from ipatests.test_xmlrpc.tracker.group_plugin import GroupTracker
+from ipatests.test_xmlrpc.tracker.host_plugin import HostTracker
+from ipatests.test_xmlrpc.tracker.hostgroup_plugin import HostGroupTracker
 import pytest
 
-group1 = u'testgroup1'
-group2 = u'testgroup2'
-group3 = u'testgroup3'
-group4 = u'testgroup4'
-user1 = u'tuser1'
-user2 = u'tuser2'
-user3 = u'tuser3'
-user4 = u'tuser4'
-
-hostgroup1 = u'testhostgroup1'
-hgdn1 = DN(('cn',hostgroup1),('cn','hostgroups'),('cn','accounts'),
-   api.env.basedn)
-hostgroup2 = u'testhostgroup2'
-hgdn2 = DN(('cn',hostgroup2),('cn','hostgroups'),('cn','accounts'),
-   api.env.basedn)
-
-fqdn1 = u'testhost1.%s' % api.env.domain
-host_dn1 = DN(('fqdn',fqdn1),('cn','computers'),('cn','accounts'),
-  api.env.basedn)
+
+@pytest.fixture(scope='class')
+def user1(request):
+tracker = UserTracker(name=u'tuser1', givenname=u'Test1', sn=u'User1')
+return tracker.make_fixture(request)
+
+
+@pytest.fixture(scope='class')
+def user2(request):
+tracker = UserTracker(name=u'tuser2', givenname=u'Test2', sn=u'User2')
+return tracker.make_fixture(request)
+
+
+@pytest.fixture(scope='class')
+def user3(request):
+tracker = UserTracker(name=u'tuser3', givenname=u'Test3', sn=u'User3')
+return tracker.make_fixture(request)
+
+
+@pytest.fixture(scope='class')
+def user4(request):
+tracker = UserTracker(name=u'tuser4', givenname=u'Test4', sn=u'User4')
+return tracker.make_fixture(request)
+
+
+@pytest.fixture(scope='class')
+def group1(request):
+tracker = GroupTracker(name=u'testgroup1', description=u'Test desc1')
+return tracker.make_fixture(request)
+
+
+@pytest.fixture(scope='class')
+def group2(request):
+tracker = GroupTracker(name=u'testgroup2', description=u'Test desc2&

Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin

2016-01-15 Thread Filip Skola
t; > > > >>> 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
From 35c9601bba7dcaa4d8c09d23ee9f1eb95dab77a0 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| 2396 ++-
 ipatests/test_xmlrpc/tracker/user_plugin.py |  169 +-
 2 files changed, 1045 insertions(+), 1520 deletions(-)

diff --git a/ipatests/test_xmlrpc/test_user_plugin.py b/ipatests/test_xmlrpc/test_user_plugin.py
index 084fb83c42d362204ff4547357226c8f56d217fb..11c23269e3f68b8d62328169b01baf3af92651a2 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,41 @@ 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,

Re: [Freeipa-devel] [PATCH 0002] Refactor test_group_plugin

2016-01-15 Thread Filip Skola
Hi,

sending rebased patch.

F.

- Original Message -
> Hello,
> 
> sorry for delays. The patch no longer applies to master. Rebase it, please.
> 
> Milan
> 
> - Original Message -
> From: "Filip Škola" 
> To: "Milan Kubík" 
> Cc: freeipa-devel@redhat.com
> Sent: Wednesday, 9 December, 2015 7:01:02 PM
> Subject: Re: [Freeipa-devel] [PATCH 0002] Refactor test_group_plugin
> 
> On Mon, 7 Dec 2015 17:49:18 +0100
> Milan Kubík  wrote:
> 
> > On 12/03/2015 08:15 PM, Filip Škola wrote:
> > > On Mon, 30 Nov 2015 17:18:30 +0100
> > > Milan Kubík  wrote:
> > >
> > >> On 11/23/2015 04:42 PM, Filip Škola wrote:
> > >>> Sending updated patch.
> > >>>
> > >>> F.
> > >>>
> > >>> On Mon, 23 Nov 2015 14:59:34 +0100
> > >>> Filip Škola  wrote:
> > >>>
> > >>>> Found couple of issues (broke some dependencies).
> > >>>>
> > >>>> NACK
> > >>>>
> > >>>> F.
> > >>>>
> > >>>> On Fri, 20 Nov 2015 13:56:36 +0100
> > >>>> Filip Škola  wrote:
> > >>>>
> > >>>>> Another one.
> > >>>>>
> > >>>>> F.
> > >>>
> > >> Hi, the tests look good. Few remarks, though.
> > >>
> > >> 1. Please, use the shortes copyright notice in new modules.
> > >>
> > >>   #
> > >>   # Copyright (C) 2015  FreeIPA Contributors see COPYING for
> > >> license #
> > >>
> > >> 2. The tests `test_group_remove_group_from_protected_group` and
> > >> `test_group_full_set_of_objectclass_not_available_post_detach`
> > >> were not ported. Please, include them in the patch.
> > >>
> > >> Also, for less hassle, please rebase your patches on top of
> > >> freeipa-mkubik-0025-3-Separated-Tracker-implementations-into-standalone-pa.patch
> > >> Which changes the location of tracker implementations and prevents
> > >> circular imports.
> > >>
> > >> Thanks.
> > >>
> > >
> > >
> > > Hi,
> > >
> > > these cases are there, in corresponding classes. They are marked
> > > with the original comments. (However I can move them to separate
> > > class if desirable.)
> > >
> > > The copyright notice is changed. Also included a few changes in the
> > > test with user without private group.
> > >
> > > Filip
> > NACK
> > 
> > linter:
> > * Module tracker.group_plugin
> > ipatests/test_xmlrpc/tracker/group_plugin.py:257:
> > [E0102(function-redefined), GroupTracker.check_remove_member] method
> > already defined line 253)
> > 
> > Probably a leftover after the rebase made on top of my patch. Please
> > fix it. You can check youch changes by make-lint script before
> > sending them.
> > 
> > Thanks
> > 
> 
> 
> Hi,
> 
> I learned to use make-lint!
> 
> Thanks,
> F.
> 
From 0f4585c1595cb0130c771d61f883c80a4349ff98 Mon Sep 17 00:00:00 2001
From: Filip Skola 
Date: Mon, 9 Nov 2015 16:48:55 +0100
Subject: [PATCH] Refactor test_group_plugin, use GroupTracker for tests

---
 ipatests/test_xmlrpc/test_group_plugin.py | 1738 +
 ipatests/test_xmlrpc/test_stageuser_plugin.py |4 +-
 ipatests/test_xmlrpc/tracker/group_plugin.py  |  146 ++-
 3 files changed, 735 insertions(+), 1153 deletions(-)

diff --git a/ipatests/test_xmlrpc/test_group_plugin.py b/ipatests/test_xmlrpc/test_group_plugin.py
index 6eb57c12f18d125de04beefa056f53b4caff1d64..ee672859376fcd2823907ed9d3ffc77943f1061a 100644
--- a/ipatests/test_xmlrpc/test_group_plugin.py
+++ b/ipatests/test_xmlrpc/test_group_plugin.py
@@ -1,6 +1,7 @@
 # Authors:
 #   Rob Crittenden 
 #   Pavel Zuna 
+#   Filip Skola 
 #
 # Copyright (C) 2008  Red Hat
 # see file 'COPYING' for use and warranty information
@@ -23,1141 +24,646 @@ Test the `ipalib/plugins/group.py` module.
 
 import pytest
 
-from ipalib import api, errors
+from ipalib import errors
 from ipatests.test_xmlrpc import objectclasses
 from ipatests.test_xmlrpc.xmlrpc_test import (
-Declarative,
-fuzzy_digits,
-fuzzy_uuid,
-fuzzy_set_ci,
-add_sid,
-add_oc)
-from ipapython.dn import DN
-from ipatests.test_xmlrpc.test_user_plugin import get_user_result
+fuzzy_digits, fuzzy_uuid, fuzzy_set_ci, add_oc,
+XMLRPC_test, raises_exact
+)
+from ipatests.test_xmlrpc.tracker.group_plugin import GroupTracker
+fro

Re: [Freeipa-devel] [PATCH 0005] Refactor test_nesting, create HostGroupTracker

2016-01-15 Thread Filip Skola
Hi,

sending rebased patch.

F.

- Original Message -
> Hi,
> 
> the patch no longer applies to master. Please rebase it.
> 
> Thanks,
> Milan
> 
> - Original Message -----
> From: "Filip Skola" 
> To: freeipa-devel@redhat.com
> Cc: "Milan Kubík" , "Aleš Mareček" 
> Sent: Tuesday, 22 December, 2015 11:56:15 AM
> Subject: [PATCH 0005] Refactor test_nesting, create HostGroupTracker
> 
> Hi,
> 
> another patch from refactoring-test_xmlrpc series.
> 
> Filip
> 
From 85950890a8eb97ec2d138fa9b9b2c24cc2b3d408 Mon Sep 17 00:00:00 2001
From: Filip Skola 
Date: Fri, 15 Jan 2016 15:08:46 +0100
Subject: [PATCH] Refactor test_nesting, create HostGroupTracker

---
 ipatests/test_xmlrpc/test_nesting.py   | 776 -
 ipatests/test_xmlrpc/tracker/group_plugin.py   |   4 +-
 ipatests/test_xmlrpc/tracker/host_plugin.py|   1 +
 .../{group_plugin.py => hostgroup_plugin.py}   | 218 +++---
 4 files changed, 257 insertions(+), 742 deletions(-)
 copy ipatests/test_xmlrpc/tracker/{group_plugin.py => hostgroup_plugin.py} (53%)

diff --git a/ipatests/test_xmlrpc/test_nesting.py b/ipatests/test_xmlrpc/test_nesting.py
index c3bf1ce84e0bef412c44ed847e7e0fc4648a4b74..f78a6e54bd7a94cb9d2645f5bdc5d5c109a79b1f 100644
--- a/ipatests/test_xmlrpc/test_nesting.py
+++ b/ipatests/test_xmlrpc/test_nesting.py
@@ -20,193 +20,93 @@
 Test group nesting and indirect members
 """
 
-from ipalib import api
-from ipatests.test_xmlrpc import objectclasses
-from ipatests.test_xmlrpc.xmlrpc_test import (Declarative, fuzzy_digits,
-  fuzzy_uuid)
-from ipapython.dn import DN
-from ipatests.test_xmlrpc.test_user_plugin import get_user_result
+from ipatests.test_xmlrpc.xmlrpc_test import XMLRPC_test
+from ipatests.test_xmlrpc.tracker.user_plugin import UserTracker
+from ipatests.test_xmlrpc.tracker.group_plugin import GroupTracker
+from ipatests.test_xmlrpc.tracker.host_plugin import HostTracker
+from ipatests.test_xmlrpc.tracker.hostgroup_plugin import HostGroupTracker
 import pytest
 
-group1 = u'testgroup1'
-group2 = u'testgroup2'
-group3 = u'testgroup3'
-group4 = u'testgroup4'
-user1 = u'tuser1'
-user2 = u'tuser2'
-user3 = u'tuser3'
-user4 = u'tuser4'
-
-hostgroup1 = u'testhostgroup1'
-hgdn1 = DN(('cn',hostgroup1),('cn','hostgroups'),('cn','accounts'),
-   api.env.basedn)
-hostgroup2 = u'testhostgroup2'
-hgdn2 = DN(('cn',hostgroup2),('cn','hostgroups'),('cn','accounts'),
-   api.env.basedn)
-
-fqdn1 = u'testhost1.%s' % api.env.domain
-host_dn1 = DN(('fqdn',fqdn1),('cn','computers'),('cn','accounts'),
-  api.env.basedn)
+
+@pytest.fixture(scope='class')
+def user1(request):
+tracker = UserTracker(name=u'tuser1', givenname=u'Test1', sn=u'User1')
+return tracker.make_fixture(request)
+
+
+@pytest.fixture(scope='class')
+def user2(request):
+tracker = UserTracker(name=u'tuser2', givenname=u'Test2', sn=u'User2')
+return tracker.make_fixture(request)
+
+
+@pytest.fixture(scope='class')
+def user3(request):
+tracker = UserTracker(name=u'tuser3', givenname=u'Test3', sn=u'User3')
+return tracker.make_fixture(request)
+
+
+@pytest.fixture(scope='class')
+def user4(request):
+tracker = UserTracker(name=u'tuser4', givenname=u'Test4', sn=u'User4')
+return tracker.make_fixture(request)
+
+
+@pytest.fixture(scope='class')
+def group1(request):
+tracker = GroupTracker(name=u'testgroup1', description=u'Test desc1')
+return tracker.make_fixture(request)
+
+
+@pytest.fixture(scope='class')
+def group2(request):
+tracker = GroupTracker(name=u'testgroup2', description=u'Test desc2')
+return tracker.make_fixture(request)
+
+
+@pytest.fixture(scope='class')
+def group3(request):
+tracker = GroupTracker(name=u'testgroup3', description=u'Test desc3')
+return tracker.make_fixture(request)
+
+
+@pytest.fixture(scope='class')
+def group4(request):
+tracker = GroupTracker(name=u'testgroup4', description=u'Test desc4')
+return tracker.make_fixture(request)
+
+
+@pytest.fixture(scope='class')
+def host1(request):
+tracker = HostTracker(name=u'host1')
+return tracker.make_fixture(request)
+
+
+@pytest.fixture(scope='class')
+def hostgroup1(request):
+tracker = HostGroupTracker(name=u'hostgroup1')
+re

[Freeipa-devel] [PATCH 0006] Refactor test_hostgroup_plugin

2015-12-22 Thread Filip Skola
And also sending refactored hostgroup plugin test.

FFrom a52f4f832a244ee53aa034d8d5ba645e83caa2e1 Mon Sep 17 00:00:00 2001
From: Filip Skola 
Date: Fri, 18 Dec 2015 15:25:21 +0100
Subject: [PATCH] Refactor test_hostgroup_plugin

---
 ipatests/test_xmlrpc/test_hostgroup_plugin.py | 377 +++---
 1 file changed, 100 insertions(+), 277 deletions(-)

diff --git a/ipatests/test_xmlrpc/test_hostgroup_plugin.py b/ipatests/test_xmlrpc/test_hostgroup_plugin.py
index 58665f466a18a4fb27c9f4e05cf4e89e1f48ccb1..61fda819b979f432150b95e54771130909b230d7 100644
--- a/ipatests/test_xmlrpc/test_hostgroup_plugin.py
+++ b/ipatests/test_xmlrpc/test_hostgroup_plugin.py
@@ -22,294 +22,117 @@
 Test the `ipalib.plugins.hostgroup` module.
 """
 
-from ipalib import api, errors
-from ipatests.test_xmlrpc.xmlrpc_test import Declarative, fuzzy_uuid
-from ipatests.test_xmlrpc import objectclasses
-from ipapython.dn import DN
+
+from ipatests.test_xmlrpc.xmlrpc_test import XMLRPC_test, raises_exact
+from ipatests.test_xmlrpc.tracker.hostgroup_plugin import HostGroupTracker
+from ipatests.test_xmlrpc.tracker.host_plugin import HostTracker
+from ipalib import errors
 import pytest
 
-hostgroup1 = u'testhostgroup1'
-dn1 = DN(('cn',hostgroup1),('cn','hostgroups'),('cn','accounts'),
- api.env.basedn)
 
-hostgroup_single = u'a'
-dn_single = DN(('cn',hostgroup_single),('cn','hostgroups'),('cn','accounts'),
- api.env.basedn)
+@pytest.fixture(scope='class')
+def hostgroup(request):
+tracker = HostGroupTracker(name=u'hostgroup')
+return tracker.make_fixture(request)
 
-fqdn1 = u'testhost1.%s' % api.env.domain
-host_dn1 = DN(('fqdn',fqdn1),('cn','computers'),('cn','accounts'),
-  api.env.basedn)
 
-invalidhostgroup1 = u'@invalid'
+@pytest.fixture(scope='class')
+def hostgroup_invalid(request):
+tracker = HostGroupTracker(name=u'@invalid')
+return tracker.make_fixture(request)
 
 
-@pytest.mark.tier1
-class test_hostgroup(Declarative):
+@pytest.fixture(scope='class')
+def hostgroup_single(request):
+tracker = HostGroupTracker(name=u'a')
+return tracker.make_fixture(request)
 
-cleanup_commands = [
-('hostgroup_del', [hostgroup1], {}),
-('host_del', [fqdn1], {}),
-]
 
-tests=[
+@pytest.fixture(scope='class')
+def host(request):
+tracker = HostTracker(name=u'host')
+return tracker.make_fixture(request)
 
-dict(
-desc='Try to retrieve non-existent %r' % hostgroup1,
-command=('hostgroup_show', [hostgroup1], {}),
-expected=errors.NotFound(
-reason=u'%s: host group not found' % hostgroup1),
-),
 
+class TestNonexistentHostGroup(XMLRPC_test):
+def test_retrieve_nonexistent(self, hostgroup):
+""" Try to retrieve non-existent hostgroup """
+hostgroup.ensure_missing()
+command = hostgroup.make_retrieve_command()
+with raises_exact(errors.NotFound(
+reason=u'%s: host group not found' % hostgroup.cn)):
+command()
 
-dict(
-desc='Try to update non-existent %r' % hostgroup1,
-command=('hostgroup_mod', [hostgroup1],
-dict(description=u'Updated hostgroup 1')
-),
-expected=errors.NotFound(
-reason=u'%s: host group not found' % hostgroup1),
-),
-
-
-dict(
-desc='Try to delete non-existent %r' % hostgroup1,
-command=('hostgroup_del', [hostgroup1], {}),
-expected=errors.NotFound(
-reason=u'%s: host group not found' % hostgroup1),
-),
-
-
-dict(
-desc='Test an invalid hostgroup name %r' % invalidhostgroup1,
-command=('hostgroup_add', [invalidhostgroup1], dict(description=u'Test')),
-expected=errors.ValidationError(name='hostgroup_name',
-error=u'may only include letters, numbers, _, -, and .'),
-),
-
-
-dict(
-desc='Create %r' % hostgroup1,
-command=('hostgroup_add', [hostgroup1],
-dict(description=u'Test hostgroup 1')
-),
-expected=dict(
-value=hostgroup1,
-summary=u'Added hostgroup "testhostgroup1"',
-result=dict(
-dn=dn1,
-cn=[hostgroup1],
-objectclass=objectclasses.hostgroup,
-

[Freeipa-devel] [PATCH 0005] Refactor test_nesting, create HostGroupTracker

2015-12-22 Thread Filip Skola
Hi,

another patch from refactoring-test_xmlrpc series.

Filip
From f2611f7d364657c0cf425d93b8a7262847e8b715 Mon Sep 17 00:00:00 2001
From: Filip Skola 
Date: Tue, 22 Dec 2015 11:33:32 +0100
Subject: [PATCH] Refactor test_nesting, create HostGroupTracker

---
 ipatests/test_xmlrpc/test_nesting.py   | 776 -
 ipatests/test_xmlrpc/tracker/group_plugin.py   |   4 +-
 ipatests/test_xmlrpc/tracker/host_plugin.py|   1 +
 .../{group_plugin.py => hostgroup_plugin.py}   | 222 +++---
 4 files changed, 255 insertions(+), 748 deletions(-)
 copy ipatests/test_xmlrpc/tracker/{group_plugin.py => hostgroup_plugin.py} (52%)

diff --git a/ipatests/test_xmlrpc/test_nesting.py b/ipatests/test_xmlrpc/test_nesting.py
index c3bf1ce84e0bef412c44ed847e7e0fc4648a4b74..f78a6e54bd7a94cb9d2645f5bdc5d5c109a79b1f 100644
--- a/ipatests/test_xmlrpc/test_nesting.py
+++ b/ipatests/test_xmlrpc/test_nesting.py
@@ -20,193 +20,93 @@
 Test group nesting and indirect members
 """
 
-from ipalib import api
-from ipatests.test_xmlrpc import objectclasses
-from ipatests.test_xmlrpc.xmlrpc_test import (Declarative, fuzzy_digits,
-  fuzzy_uuid)
-from ipapython.dn import DN
-from ipatests.test_xmlrpc.test_user_plugin import get_user_result
+from ipatests.test_xmlrpc.xmlrpc_test import XMLRPC_test
+from ipatests.test_xmlrpc.tracker.user_plugin import UserTracker
+from ipatests.test_xmlrpc.tracker.group_plugin import GroupTracker
+from ipatests.test_xmlrpc.tracker.host_plugin import HostTracker
+from ipatests.test_xmlrpc.tracker.hostgroup_plugin import HostGroupTracker
 import pytest
 
-group1 = u'testgroup1'
-group2 = u'testgroup2'
-group3 = u'testgroup3'
-group4 = u'testgroup4'
-user1 = u'tuser1'
-user2 = u'tuser2'
-user3 = u'tuser3'
-user4 = u'tuser4'
-
-hostgroup1 = u'testhostgroup1'
-hgdn1 = DN(('cn',hostgroup1),('cn','hostgroups'),('cn','accounts'),
-   api.env.basedn)
-hostgroup2 = u'testhostgroup2'
-hgdn2 = DN(('cn',hostgroup2),('cn','hostgroups'),('cn','accounts'),
-   api.env.basedn)
-
-fqdn1 = u'testhost1.%s' % api.env.domain
-host_dn1 = DN(('fqdn',fqdn1),('cn','computers'),('cn','accounts'),
-  api.env.basedn)
+
+@pytest.fixture(scope='class')
+def user1(request):
+tracker = UserTracker(name=u'tuser1', givenname=u'Test1', sn=u'User1')
+return tracker.make_fixture(request)
+
+
+@pytest.fixture(scope='class')
+def user2(request):
+tracker = UserTracker(name=u'tuser2', givenname=u'Test2', sn=u'User2')
+return tracker.make_fixture(request)
+
+
+@pytest.fixture(scope='class')
+def user3(request):
+tracker = UserTracker(name=u'tuser3', givenname=u'Test3', sn=u'User3')
+return tracker.make_fixture(request)
+
+
+@pytest.fixture(scope='class')
+def user4(request):
+tracker = UserTracker(name=u'tuser4', givenname=u'Test4', sn=u'User4')
+return tracker.make_fixture(request)
+
+
+@pytest.fixture(scope='class')
+def group1(request):
+tracker = GroupTracker(name=u'testgroup1', description=u'Test desc1')
+return tracker.make_fixture(request)
+
+
+@pytest.fixture(scope='class')
+def group2(request):
+tracker = GroupTracker(name=u'testgroup2', description=u'Test desc2')
+return tracker.make_fixture(request)
+
+
+@pytest.fixture(scope='class')
+def group3(request):
+tracker = GroupTracker(name=u'testgroup3', description=u'Test desc3')
+return tracker.make_fixture(request)
+
+
+@pytest.fixture(scope='class')
+def group4(request):
+tracker = GroupTracker(name=u'testgroup4', description=u'Test desc4')
+return tracker.make_fixture(request)
+
+
+@pytest.fixture(scope='class')
+def host1(request):
+tracker = HostTracker(name=u'host1')
+return tracker.make_fixture(request)
+
+
+@pytest.fixture(scope='class')
+def hostgroup1(request):
+tracker = HostGroupTracker(name=u'hostgroup1')
+return tracker.make_fixture(request)
+
+
+@pytest.fixture(scope='class')
+def hostgroup2(request):
+tracker = HostGroupTracker(name=u'hostgroup2')
+return tracker.make_fixture(request)
 
 
 @pytest.mark.tier1
-class test_nesting(Declarative):
-cleanup_commands = [
-('group_del', [group1], {}),
-('group_del', [group2], {}),
-('group_del', [group3], {}),
-('group_del', [group4], {}),

Re: [Freeipa-devel] [PATCH] 0001 Refactor test_user_plugin

2015-12-13 Thread Filip Skola
.
> > > > > > >>
> > > > > > >>   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 9f74d5b9e221270d8f4391f3adda606bb4d6fdb9 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| 2389 ++-
 ipatests/test_xmlrpc/tracker/user_plugin.py |  172 +-
 2 files changed, 1040 insertions(+), 1521 deletions(-)

diff --git a/ipatests/test_xmlrpc/test_user_plugin.py b/ipatests/test_xmlrpc/test_user_plugin.py
index 084fb83c42d362204ff4547357226c8f56d217fb..d0f91d8415c8408d5937214311611dd48208dd62 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.tracker.base 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'
+invaliduser2 = u''.join(['a' for n in range(256)])
 
 sshpubkey = (u'ssh-rsa B3NzaC1yc2EDAQABAAABAQDGAX3xAeLeaJggwTqMjxNwa6X'
-  'HBUAikXPGMzEpVrlLDCZtv00djsFTBi38PkgxBJVkgRWMrcBsr/35lq7P6w8KGI'
-  'wA8GI48Z0qBS2NBMJ2u9WQ2hjLN6GdMlo77O0uJY3251p12pCVIS/bHRSq8kHO2'
-  'No8g7KA9fGGcagPfQH+ee3t7HUkpbQkFTmbPPN++r3V8oVUk5LxbryB3UIIVzNm'
-  'cSIn3J