dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone
Blob Blame History Raw
From cb355831d3f128688b33b9099ec047f8ef6a3234 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michal=20=C5=BDidek?= <mzidek@redhat.com>
Date: Tue, 6 Sep 2016 17:37:14 +0200
Subject: [PATCH 130/135] TESTS: sss_groupadd/groupshow regressions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Adds regression CI test for ticket #3173 and #3175.

Resolves:
https://fedorahosted.org/sssd/ticket/3173
https://fedorahosted.org/sssd/ticket/3175

Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
(cherry picked from commit 20c2d76d9430a1fc069531ff537df046a74c8f61)
---
 src/tests/intg/test_local_domain.py | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/src/tests/intg/test_local_domain.py b/src/tests/intg/test_local_domain.py
index 31834b5b9ab93329ac5eb76e3676d6f89f5b996e..56e3812b113b36301d1ec6049e5a1210d3070442 100644
--- a/src/tests/intg/test_local_domain.py
+++ b/src/tests/intg/test_local_domain.py
@@ -19,11 +19,13 @@
 import os
 import stat
 import pwd
+import grp
 import time
 import config
 import signal
 import subprocess
 import pytest
+import ent
 from util import unindent
 
 
@@ -90,6 +92,11 @@ def assert_nonexistent_user(name):
         pwd.getpwnam(name)
 
 
+def assert_nonexistent_group(name):
+    with pytest.raises(KeyError):
+        grp.getgrnam(name)
+
+
 def test_wrong_LC_ALL(local_domain_only):
     """
     Regression test for ticket
@@ -106,4 +113,23 @@ def test_wrong_LC_ALL(local_domain_only):
     # sss_userdel must remove the user despite wrong LC_ALL
     subprocess.check_call(["sss_userdel", "foo", "-R"])
     assert_nonexistent_user("foo")
-    os.environ["LC_LOCAL"] = oldvalue
+    os.environ["LC_ALL"] = oldvalue
+
+
+def test_sss_group_add_show_del(local_domain_only):
+    """
+    Regression test for tickets
+    https://fedorahosted.org/sssd/ticket/3173
+    https://fedorahosted.org/sssd/ticket/3175
+    """
+
+    subprocess.check_call(["sss_groupadd", "foo", "-g", "10001"])
+
+    "This should not raise KeyError"
+    ent.assert_group_by_name("foo", dict(name="foo", gid=10001))
+
+    "sss_grupshow should return 0 with existing group name"
+    subprocess.check_call(["sss_groupshow", "foo"])
+
+    subprocess.check_call(["sss_groupdel", "foo"])
+    assert_nonexistent_group("foo")
-- 
2.7.4