dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone

Blame SOURCES/0130-TESTS-sss_groupadd-groupshow-regressions.patch

b2d430
From cb355831d3f128688b33b9099ec047f8ef6a3234 Mon Sep 17 00:00:00 2001
b2d430
From: =?UTF-8?q?Michal=20=C5=BDidek?= <mzidek@redhat.com>
b2d430
Date: Tue, 6 Sep 2016 17:37:14 +0200
b2d430
Subject: [PATCH 130/135] TESTS: sss_groupadd/groupshow regressions
b2d430
MIME-Version: 1.0
b2d430
Content-Type: text/plain; charset=UTF-8
b2d430
Content-Transfer-Encoding: 8bit
b2d430
b2d430
Adds regression CI test for ticket #3173 and #3175.
b2d430
b2d430
Resolves:
b2d430
https://fedorahosted.org/sssd/ticket/3173
b2d430
https://fedorahosted.org/sssd/ticket/3175
b2d430
b2d430
Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
b2d430
(cherry picked from commit 20c2d76d9430a1fc069531ff537df046a74c8f61)
b2d430
---
b2d430
 src/tests/intg/test_local_domain.py | 28 +++++++++++++++++++++++++++-
b2d430
 1 file changed, 27 insertions(+), 1 deletion(-)
b2d430
b2d430
diff --git a/src/tests/intg/test_local_domain.py b/src/tests/intg/test_local_domain.py
b2d430
index 31834b5b9ab93329ac5eb76e3676d6f89f5b996e..56e3812b113b36301d1ec6049e5a1210d3070442 100644
b2d430
--- a/src/tests/intg/test_local_domain.py
b2d430
+++ b/src/tests/intg/test_local_domain.py
b2d430
@@ -19,11 +19,13 @@
b2d430
 import os
b2d430
 import stat
b2d430
 import pwd
b2d430
+import grp
b2d430
 import time
b2d430
 import config
b2d430
 import signal
b2d430
 import subprocess
b2d430
 import pytest
b2d430
+import ent
b2d430
 from util import unindent
b2d430
 
b2d430
 
b2d430
@@ -90,6 +92,11 @@ def assert_nonexistent_user(name):
b2d430
         pwd.getpwnam(name)
b2d430
 
b2d430
 
b2d430
+def assert_nonexistent_group(name):
b2d430
+    with pytest.raises(KeyError):
b2d430
+        grp.getgrnam(name)
b2d430
+
b2d430
+
b2d430
 def test_wrong_LC_ALL(local_domain_only):
b2d430
     """
b2d430
     Regression test for ticket
b2d430
@@ -106,4 +113,23 @@ def test_wrong_LC_ALL(local_domain_only):
b2d430
     # sss_userdel must remove the user despite wrong LC_ALL
b2d430
     subprocess.check_call(["sss_userdel", "foo", "-R"])
b2d430
     assert_nonexistent_user("foo")
b2d430
-    os.environ["LC_LOCAL"] = oldvalue
b2d430
+    os.environ["LC_ALL"] = oldvalue
b2d430
+
b2d430
+
b2d430
+def test_sss_group_add_show_del(local_domain_only):
b2d430
+    """
b2d430
+    Regression test for tickets
b2d430
+    https://fedorahosted.org/sssd/ticket/3173
b2d430
+    https://fedorahosted.org/sssd/ticket/3175
b2d430
+    """
b2d430
+
b2d430
+    subprocess.check_call(["sss_groupadd", "foo", "-g", "10001"])
b2d430
+
b2d430
+    "This should not raise KeyError"
b2d430
+    ent.assert_group_by_name("foo", dict(name="foo", gid=10001))
b2d430
+
b2d430
+    "sss_grupshow should return 0 with existing group name"
b2d430
+    subprocess.check_call(["sss_groupshow", "foo"])
b2d430
+
b2d430
+    subprocess.check_call(["sss_groupdel", "foo"])
b2d430
+    assert_nonexistent_group("foo")
b2d430
-- 
b2d430
2.7.4
b2d430