Re: [Freeipa-devel] [PATCH 0006] Refactor test_hostgroup_plugin

2016-03-24 Thread Martin Basti



On 24.03.2016 11:59, Milan Kubík wrote:

On 03/07/2016 02:53 PM, Filip Škola wrote:

Sorry, forgot to cc you, Milan.

F.

On Tue, 22 Dec 2015 05:57:50 -0500 (EST)
Filip Skola  wrote:


And also sending refactored hostgroup plugin test.

F

Sorry for long delay. ACK.


Pushed to master: 49c015b2ed6063157bb5e07882ae2ad7e9508971

--
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 0006] Refactor test_hostgroup_plugin

2016-03-24 Thread Milan Kubík

On 03/07/2016 02:53 PM, Filip Škola wrote:

Sorry, forgot to cc you, Milan.

F.

On Tue, 22 Dec 2015 05:57:50 -0500 (EST)
Filip Skola  wrote:


And also sending refactored hostgroup plugin test.

F

Sorry for long delay. ACK.

--
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 0006] Refactor test_hostgroup_plugin

2016-03-07 Thread Filip Škola
Sorry, forgot to cc you, Milan.

F.

On Tue, 22 Dec 2015 05:57:50 -0500 (EST)
Filip Skola  wrote:

> And also sending refactored hostgroup plugin test.
> 
> F

-- 
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 0006] Refactor test_hostgroup_plugin

2016-02-23 Thread Martin Basti



On 22.12.2015 11:57, Filip Skola wrote:

And also sending refactored hostgroup plugin test.

F



bump for review
-- 
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 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,
-description=[u'Test hostgroup 1'],
-ipauniqueid=[fuzzy_uuid],
-mepmanagedentry=[DN(('cn',hostgroup1),('cn','ng'),('cn','alt'),
-api.env.basedn)],
-),
-),
-),
-
-
-dict(
-desc='Try to create duplicate %r' % hostgroup1,
-command=('hostgroup_add', [hostgroup1],
-dict(description=u'Test hostgroup 1')
-),
-