URL: https://github.com/SSSD/sssd/pull/756
Author: mrniranjan
 Title: #756: TESTS: Add test case title with @title in docstrings
Action: opened

PR body:
"""
Adding test case titles starting with @title.  
When pytest is run with --junit-xml, the resulting junit file contains test 
function name as test case name. 

With the help of [pytest-modifyjunit](https://pagure.io/pytest-modifyjunit) , 
this plugin replaces test function name with test case title described with 
@title. 

sssd qe uses the junit.xml to import the result to Test case management system 
which tries to match the test case names in junit.xml with the test case title 
described in tcms. 

https://paste.fedoraproject.org/paste/dHR218kinyECa1yHiLXGxg is the junit.xml 
which doesn't contain test case title. 

https://paste.fedoraproject.org/paste/kVUlc-2mIibW18ILzbyqcg is the junit.xml 
which contains test case names with as defined in @title. 

"""

To pull the PR as Git branch:
git remote add ghsssd https://github.com/SSSD/sssd
git fetch ghsssd pull/756/head:pr756
git checkout pr756
From 27cfb3eea7172e9367d72fdfd0b1a3a3b38b6209 Mon Sep 17 00:00:00 2001
From: "Niranjan M.R" <mrniran...@redhat.com>
Date: Fri, 15 Feb 2019 17:08:36 +0530
Subject: [PATCH 1/6] TESTS: Add @Title to test case docstrings for basic
 sanity tests

Adding @Title to specify test case title makes
the junit to contain the test case title as test casename
instead of test case function.

This required to create test runs for test case management
system.

Signed-off-by: Niranjan M.R <mrniran...@redhat.com>
---
 src/tests/multihost/basic/test_basic.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/tests/multihost/basic/test_basic.py b/src/tests/multihost/basic/test_basic.py
index 88e7593078..837710cf21 100644
--- a/src/tests/multihost/basic/test_basic.py
+++ b/src/tests/multihost/basic/test_basic.py
@@ -9,7 +9,7 @@
 class TestSanitySSSD(object):
     """ Basic Sanity Test cases """
     def test_ssh_user_login(self, multihost):
-        """Check ssh login as LDAP user with Kerberos credentials """
+        """@Title: Check ssh login as LDAP user with Kerberos credentials """
         try:
             ssh = SSHClient(multihost.master[0].sys_hostname,
                             username='foo1', password='Secret123')
@@ -20,7 +20,7 @@ def test_ssh_user_login(self, multihost):
             ssh.close()
 
     def test_kinit(self, multihost):
-        """ Run kinit after user login """
+        """@Title: Verify kinit is successfull after user login """
         try:
             ssh = SSHClient(multihost.master[0].sys_hostname,
                             username='foo2', password='Secret123')
@@ -37,7 +37,7 @@ def test_kinit(self, multihost):
                 ssh.close()
 
     def test_offline_ssh_login(self, multihost):
-        """ Test Offline ssh login """
+        """@Title: Verify offline ssh login """
         multihost.master[0].transport.get_file('/etc/sssd/sssd.conf',
                                                '/tmp/sssd.conf')
         sssdconfig = ConfigParser.RawConfigParser()

From 8ed5cb89c0b46552c939c9c63a7dabda6ea12287 Mon Sep 17 00:00:00 2001
From: "Niranjan M.R" <mrniran...@redhat.com>
Date: Fri, 15 Feb 2019 17:16:36 +0530
Subject: [PATCH 2/6] TESTS: Add @Title to test case docstrings for config
 tests

Signed-off-by: Niranjan M.R <mrniran...@redhat.com>
---
 src/tests/multihost/basic/test_config.py | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/tests/multihost/basic/test_config.py b/src/tests/multihost/basic/test_config.py
index 3e3a76bead..b2ecaa97eb 100644
--- a/src/tests/multihost/basic/test_config.py
+++ b/src/tests/multihost/basic/test_config.py
@@ -21,7 +21,7 @@ def _assert_config_value(self, multihost, section, key, value):
 
     def test_sssd_genconf_sssd_running(self, multihost):
         """
-        Test that sssd --genconf is able to re-generate the configuration
+        @Title: sssd --genconf is able to re-generate the configuration
         even while SSSD is running.
         """
         multihost.master[0].service_sssd('restart')
@@ -36,7 +36,7 @@ def test_sssd_genconf_sssd_running(self, multihost):
 
     def test_sssd_genconf_section_only(self, multihost):
         """
-        Test that --genconf-section only refreshes those sections given
+        @Title: sssd --genconf-section only refreshes those sections given
         on the command line
         """
         multihost.master[0].service_sssd('restart')
@@ -59,7 +59,7 @@ def test_sssd_genconf_section_only(self, multihost):
 
     def test_sssd_genconf_add_remove_section(self, multihost):
         """
-        Test that --genconf-section can not only modify existing
+        @Title: sssd --genconf-section can not only modify existing
         configuration sections, but also add a new section
         """
         # Establish a baseline
@@ -89,8 +89,10 @@ def test_sssd_genconf_add_remove_section(self, multihost):
 
     def test_sssd_genconf_no_such_section(self, multihost):
         """
-        Referencing a non-existant section must not fail, because
-        we want to call this command from the systemd unit files
+        @Title: Referencing a non-existant section must not fail
+        
+        @Description: Referencing a non-existant section must not fail, 
+        because we want to call this command from the systemd unit files
         and by default the sections don't have to be present
         """
         multihost.master[0].service_sssd('restart')

From a687e3e029146875d0b4a93c8e03862b45593339 Mon Sep 17 00:00:00 2001
From: "Niranjan M.R" <mrniran...@redhat.com>
Date: Fri, 15 Feb 2019 17:16:57 +0530
Subject: [PATCH 3/6] TESTS: Add @Title to test case docstrings for KCM tests

Signed-off-by: Niranjan M.R <mrniran...@redhat.com>
---
 src/tests/multihost/basic/test_kcm.py | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/tests/multihost/basic/test_kcm.py b/src/tests/multihost/basic/test_kcm.py
index 20029f57e0..eb81ab56e8 100644
--- a/src/tests/multihost/basic/test_kcm.py
+++ b/src/tests/multihost/basic/test_kcm.py
@@ -39,7 +39,7 @@ def _kcm_log_length(self, multihost):
         return nlines
 
     def test_kinit_kcm(self, multihost, enable_kcm):
-        """ Run kinit with KRB5CCNAME=KCM: """
+        """@Title: Run kinit with KRB5CCNAME=KCM: """
         self._start_kcm(multihost)
         try:
             ssh = SSHClient(multihost.master[0].sys_hostname,
@@ -61,7 +61,7 @@ def test_kinit_kcm(self, multihost, enable_kcm):
             ssh.close()
 
     def test_ssh_login_kcm(self, multihost, enable_kcm):
-        """ Verify ssh logins are successuful with kcm as default """
+        """@Title: Verify ssh logins are successuful with kcm as default """
         # pylint: disable=unused-argument
         _pytest_fixture = [enable_kcm]
         try:
@@ -77,8 +77,11 @@ def test_ssh_login_kcm(self, multihost, enable_kcm):
 
     def test_kcm_debug_level_set(self, multihost, enable_kcm):
         """
-        Test that just adding a [kcm] section and restarting the kcm
-        service enables debugging without having to restart the
+        @Title: After kcm section with debug level set restaring sssd-kcm 
+        service enables kcm debugging
+
+        @Description: Test that just adding a [kcm] section and restarting 
+        the kcm service enables debugging without having to restart the
         whole sssd
         """
         # Start from a known-good state where the configuration is refreshed
@@ -125,7 +128,7 @@ def test_kcm_debug_level_set(self, multihost, enable_kcm):
 
     def test_kdestroy_retval(self, multihost, enable_kcm):
         """
-        Test that destroying an empty cache does not return a non-zero
+        @Title: Test that destroying an empty cache does not return a non-zero
         return code.
         """
         ssh = SSHClient(multihost.master[0].sys_hostname,
@@ -142,7 +145,7 @@ def test_kdestroy_retval(self, multihost, enable_kcm):
 
     def test_ssh_forward_creds(self, multihost, enable_kcm):
         """
-        Test that SSH can forward credentials with KCM
+        @Title: Test that SSH can forward credentials with KCM
 
         A regression test for https://pagure.io/SSSD/sssd/issue/3873
         """

From 79ad310491bcf8c6c0f562c03a2a8080f3f6a909 Mon Sep 17 00:00:00 2001
From: "Niranjan M.R" <mrniran...@redhat.com>
Date: Fri, 15 Feb 2019 17:17:12 +0530
Subject: [PATCH 4/6] TESTS: Add @Title to test case docstrings for sssctl
 config tests

Signed-off-by: Niranjan M.R <mrniran...@redhat.com>
---
 src/tests/multihost/basic/test_sssctl_config_check.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/tests/multihost/basic/test_sssctl_config_check.py b/src/tests/multihost/basic/test_sssctl_config_check.py
index c50c2e64a5..fe962a80d5 100644
--- a/src/tests/multihost/basic/test_sssctl_config_check.py
+++ b/src/tests/multihost/basic/test_sssctl_config_check.py
@@ -6,7 +6,7 @@
 
 class TestSssctlConfigCheck(object):
     def test_verify_typo_option_name(self, multihost):
-        """ Verify typos in option name (not value) of configuration file """
+        """@Title: Verify typos in option name (not value) of configuration file """
         cfgget = '/etc/sssd/sssd.conf'
         cfgput = '/tmp/sssd.conf.backup'
         multihost.master[0].run_command(['/bin/cp',
@@ -32,7 +32,7 @@ def test_verify_typo_option_name(self, multihost):
                                         raiseonerr=False)
 
     def test_verify_typo_domain_name(self, multihost):
-        """ Verify typos in domain name of configuration file """
+        """@Title: Verify typos in domain name of configuration file """
         cfgget = '/etc/sssd/sssd.conf'
         cfgput = '/tmp/sssd.conf.backup'
         multihost.master[0].run_command(['/bin/cp',
@@ -58,7 +58,7 @@ def test_verify_typo_domain_name(self, multihost):
                                         raiseonerr=False)
 
     def test_misplaced_option(self, multihost):
-        """ Verify misplace options in default configuration file """
+        """@Title: Verify misplace options in default configuration file """
         cfgget = '/etc/sssd/sssd.conf'
         cfgput = '/tmp/sssd.conf.backup'
         sssdcfg = multihost.master[0].get_file_contents(cfgget)

From 1e5d3af91f37f6a93c6c426a33337256fc777ae6 Mon Sep 17 00:00:00 2001
From: "Niranjan M.R" <mrniran...@redhat.com>
Date: Fri, 15 Feb 2019 17:17:27 +0530
Subject: [PATCH 5/6] TESTS: Add @Title to test case docstrings for sudo tests

Signed-off-by: Niranjan M.R <mrniran...@redhat.com>
---
 src/tests/multihost/basic/test_sudo.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/tests/multihost/basic/test_sudo.py b/src/tests/multihost/basic/test_sudo.py
index 0663b805bb..89c1600ac9 100644
--- a/src/tests/multihost/basic/test_sudo.py
+++ b/src/tests/multihost/basic/test_sudo.py
@@ -10,7 +10,7 @@ class TestSanitySudo(object):
     def test_case_senitivity(self, multihost, case_sensitive_sudorule,
                              enable_sss_sudo_nsswitch,
                              set_case_sensitive_false):
-        """ Verify case sensitivity in sudo responder """
+        """@Title: Verify case sensitivity in sudo responder """
         # pylint: disable=unused-argument
         _pytest_fixtures = [case_sensitive_sudorule, enable_sss_sudo_nsswitch,
                             set_case_sensitive_false]
@@ -35,7 +35,7 @@ def test_refresh_expired_rule(self, multihost,
                                   enable_sss_sudo_nsswitch,
                                   generic_sudorule,
                                   set_entry_cache_sudo_timeout):
-        """ Verify refreshing expired sudo rules doesn't crash sssd_sudo """
+        """@Title: Verify refreshing expired sudo rules doesn't crash sssd_sudo """
         # pylint: disable=unused-argument
         _pytest_fixtures = [enable_sss_sudo_nsswitch, generic_sudorule,
                             set_entry_cache_sudo_timeout]

From 9dd1592e4baa7d6ac2544fa021b31642c629e835 Mon Sep 17 00:00:00 2001
From: "Niranjan M.R" <mrniran...@redhat.com>
Date: Fri, 15 Feb 2019 17:17:39 +0530
Subject: [PATCH 6/6] TESTS: Add @Title to test case docstrings for files tests

Signed-off-by: Niranjan M.R <mrniran...@redhat.com>
---
 src/tests/multihost/basic/test_files.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/tests/multihost/basic/test_files.py b/src/tests/multihost/basic/test_files.py
index db7608afeb..58dbbbff7d 100644
--- a/src/tests/multihost/basic/test_files.py
+++ b/src/tests/multihost/basic/test_files.py
@@ -23,19 +23,22 @@ class TestImplicitFilesProvider(object):
     together with another domain to stick close to what users use in Fedora
     """
     def test_files_does_not_handle_root(self, multihost):
-        """ The files provider does not handle root """
+        """@Title: files provider does not handle root """
         exit_status, _ = get_sss_user(multihost, 'root')
         assert exit_status == 2
 
     def test_files_sanity(self, multihost):
-        """ Test that the files provider can resolve a user """
+        """@Title: Test that the files provider can resolve a user """
         exit_status, _ = get_sss_user(multihost, 'lcl1')
         assert exit_status == 0
 
     def test_files_enumeration(self, multihost):
         """
-        Since nss_files enumerates and libc would concatenate the results,
-        the files provider of SSSD should not enumerate
+        @Title: Verify files provider do not enumerate
+
+        @Description: Since nss_files enumerates and libc would 
+        concatenate the results, the files provider of SSSD should 
+        not enumerate
         """
         cmd = multihost.master[0].run_command('getent passwd -s sss')
         assert len(cmd.stdout_text) == 0
_______________________________________________
sssd-devel mailing list -- sssd-devel@lists.fedorahosted.org
To unsubscribe send an email to sssd-devel-le...@lists.fedorahosted.org
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedorahosted.org/archives/list/sssd-devel@lists.fedorahosted.org

Reply via email to