On 07/28/2014 06:41 PM, Petr Viktorin wrote:
On 07/24/2014 03:11 PM, David Kupka wrote:
Simple test scenario from ticket #4448.
Last test will fail until patch freeipa-dkupka-0006 gets accepted.
Thanks! These look fine, but since the new tests don't require that the
rest of `test_group` is run first, I encourage you to put them in a
separate class.
Put to separate class, as suggested. Looks better now.
This would ensure we don't add new inderdependencies between old and new
tests in the future, making future test refactoring more straightforward.
Also, you can select to run just a single test class from a module, so
testing a targeted fix is faster.
(And you can reuse group1, since the other test cleans it up)
See test_permission_plugin for an example.
The test still fails on current master but works fine with patch
freeipa-dkupka-0006-2.
--
David Kupka
From 9e3c1bc8a83fc466a6e160842ab37c8e65e66229 Mon Sep 17 00:00:00 2001
From: David Kupka <[email protected]>
Date: Tue, 29 Jul 2014 08:40:36 +0200
Subject: [PATCH] test group: remove group from protected group.
Related to https://fedorahosted.org/freeipa/ticket/4448
---
ipatests/test_xmlrpc/test_group_plugin.py | 67 +++++++++++++++++++++++++++++++
1 file changed, 67 insertions(+)
diff --git a/ipatests/test_xmlrpc/test_group_plugin.py b/ipatests/test_xmlrpc/test_group_plugin.py
index 71172893beb97d3373b0b9299f2bfa7bb642dba6..26d71c4fae1a312709f6f27e0397ef3315cba33f 100644
--- a/ipatests/test_xmlrpc/test_group_plugin.py
+++ b/ipatests/test_xmlrpc/test_group_plugin.py
@@ -1009,5 +1009,72 @@ class test_group(Declarative):
value=[user1],
),
),
+ ]
+
+class test_group_remove_group_from_protected_group(Declarative):
+ cleanup_commands = [
+ ('group_del', [group1], {}),
+ ]
+ tests = [
+ # Test scenario from ticket #4448
+ # https://fedorahosted.org/freeipa/ticket/4448
+ dict(
+ desc='Add group %s' % group1,
+ command=('group_add', [group1], dict(description=u'Test desc 1')),
+ expected=dict(
+ value=group1,
+ summary=u'Added group "%s"' % group1,
+ result=dict(
+ cn=[group1],
+ description=[u'Test desc 1'],
+ objectclass=objectclasses.posixgroup,
+ gidnumber=[fuzzy_digits],
+ ipauniqueid=[fuzzy_uuid],
+ dn=get_group_dn(group1),
+ ),
+ ),
+ ),
+
+ dict(
+ desc='Add %s group to admins group' % group1,
+ command=('group_add_member', [u'admins'], dict(group=group1)),
+ expected=dict(
+ completed=1,
+ failed=dict(
+ member=dict(
+ group=tuple(),
+ user=tuple(),
+ ),
+ ),
+ result=dict(
+ dn=get_group_dn('admins'),
+ member_user=[u'admin'],
+ member_group=[group1],
+ gidnumber=[fuzzy_digits],
+ cn=[u'admins'],
+ description=[u'Account administrators group'],
+ ),
+ ),
+ ),
+ dict(
+ desc='Remove %s group from admins group' % group1,
+ command=('group_remove_member', [u'admins'], dict(group=group1)),
+ expected=dict(
+ completed=1,
+ failed=dict(
+ member=dict(
+ group=tuple(),
+ user=tuple(),
+ ),
+ ),
+ result=dict(
+ dn=get_group_dn(u'admins'),
+ cn=[u'admins'],
+ gidnumber=[fuzzy_digits],
+ member_user=[u'admin'],
+ description=[u'Account administrators group'],
+ ),
+ ),
+ ),
]
--
1.9.3
_______________________________________________
Freeipa-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/freeipa-devel