From fea1e918958d342bea90e9b5f54393cbca2e4579 Mon Sep 17 00:00:00 2001 From: Akshay Adhikari Date: Wed, 6 Dec 2017 20:17:36 +0530 Subject: [PATCH] Issue 49379 - Add Python 3 support to CI test Bug Description: sasl/allowed_mechs_test.py tests did not support python 3 Fix Description: use byte type for the supportedSASLMechanisms https://pagure.io/389-ds-base/issue/49379 Reviewed by: Simon Pichugin --- .../tests/suites/sasl/allowed_mechs_test.py | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/dirsrvtests/tests/suites/sasl/allowed_mechs_test.py b/dirsrvtests/tests/suites/sasl/allowed_mechs_test.py index 81b1c04..44ccff3 100644 --- a/dirsrvtests/tests/suites/sasl/allowed_mechs_test.py +++ b/dirsrvtests/tests/suites/sasl/allowed_mechs_test.py @@ -10,7 +10,7 @@ import pytest import os from lib389.topologies import topology_st - +from lib389.utils import ensure_list_str def test_basic_feature(topology_st): """Test the alloweed sasl mechanism feature @@ -71,7 +71,7 @@ def test_basic_feature(topology_st): # Get the supported mechanisms. This should contain PLAIN, GSSAPI, EXTERNAL at least standalone.log.info("Test we have some of the default mechanisms") - orig_mechs = standalone.rootdse.supported_sasl() + orig_mechs = ensure_list_str(standalone.rootdse.supported_sasl()) print(orig_mechs) assert('GSSAPI' in orig_mechs) assert('PLAIN' in orig_mechs) @@ -80,7 +80,7 @@ def test_basic_feature(topology_st): # Now edit the supported mechanisms. Check them again. standalone.log.info("Edit mechanisms to allow just PLAIN") standalone.config.set('nsslapd-allowed-sasl-mechanisms', 'PLAIN') - limit_mechs = standalone.rootdse.supported_sasl() + limit_mechs = ensure_list_str(standalone.rootdse.supported_sasl()) assert('PLAIN' in limit_mechs) assert('EXTERNAL' in limit_mechs) # Should always be in the allowed list, even if not set. assert('GSSAPI' not in limit_mechs) # Should not be there! @@ -89,7 +89,7 @@ def test_basic_feature(topology_st): standalone.log.info("Restart server and make sure we still have correct allowed mechs") standalone.restart() standalone.restart() - limit_mechs = standalone.rootdse.supported_sasl() + limit_mechs = ensure_list_str(standalone.rootdse.supported_sasl()) assert('PLAIN' in limit_mechs) assert('EXTERNAL' in limit_mechs) assert('GSSAPI' not in limit_mechs) @@ -97,7 +97,7 @@ def test_basic_feature(topology_st): # Set EXTERNAL, even though its always supported standalone.log.info("Edit mechanisms to allow just PLAIN and EXTERNAL") standalone.config.set('nsslapd-allowed-sasl-mechanisms', 'PLAIN, EXTERNAL') - limit_mechs = standalone.rootdse.supported_sasl() + limit_mechs = ensure_list_str(standalone.rootdse.supported_sasl()) assert('PLAIN' in limit_mechs) assert('EXTERNAL' in limit_mechs) assert('GSSAPI' not in limit_mechs) @@ -105,7 +105,7 @@ def test_basic_feature(topology_st): # Now edit the supported mechanisms. Check them again. standalone.log.info("Edit mechanisms to allow just PLAIN and GSSAPI") standalone.config.set('nsslapd-allowed-sasl-mechanisms', 'PLAIN, GSSAPI') - limit_mechs = standalone.rootdse.supported_sasl() + limit_mechs = ensure_list_str(standalone.rootdse.supported_sasl()) assert('PLAIN' in limit_mechs) assert('EXTERNAL' in limit_mechs) assert('GSSAPI' in limit_mechs) @@ -114,7 +114,7 @@ def test_basic_feature(topology_st): # Restart server twice and make sure the allowed list is the same standalone.restart() standalone.restart() # For ticket 49379 (test double restart) - limit_mechs = standalone.rootdse.supported_sasl() + limit_mechs = ensure_list_str(standalone.rootdse.supported_sasl()) assert('PLAIN' in limit_mechs) assert('EXTERNAL' in limit_mechs) assert('GSSAPI' in limit_mechs) @@ -123,7 +123,7 @@ def test_basic_feature(topology_st): # Add ANONYMOUS to the supported mechanisms and test again. standalone.log.info("Edit mechanisms to allow just PLAIN, GSSAPI, and ANONYMOUS") standalone.config.set('nsslapd-allowed-sasl-mechanisms', 'PLAIN, GSSAPI, ANONYMOUS') - limit_mechs = standalone.rootdse.supported_sasl() + limit_mechs = ensure_list_str(standalone.rootdse.supported_sasl()) assert('PLAIN' in limit_mechs) assert('EXTERNAL' in limit_mechs) assert('GSSAPI' in limit_mechs) @@ -133,7 +133,7 @@ def test_basic_feature(topology_st): # Restart server and make sure the allowed list is the same standalone.restart() standalone.restart() # For ticket 49379 (test double restart) - limit_mechs = standalone.rootdse.supported_sasl() + limit_mechs = ensure_list_str(standalone.rootdse.supported_sasl()) assert('PLAIN' in limit_mechs) assert('EXTERNAL' in limit_mechs) assert('GSSAPI' in limit_mechs) @@ -143,7 +143,7 @@ def test_basic_feature(topology_st): # Remove GSSAPI standalone.log.info("Edit mechanisms to allow just PLAIN and ANONYMOUS") standalone.config.set('nsslapd-allowed-sasl-mechanisms', 'PLAIN, ANONYMOUS') - limit_mechs = standalone.rootdse.supported_sasl() + limit_mechs = ensure_list_str(standalone.rootdse.supported_sasl()) assert('PLAIN' in limit_mechs) assert('EXTERNAL' in limit_mechs) assert('GSSAPI' not in limit_mechs) @@ -152,7 +152,7 @@ def test_basic_feature(topology_st): # Restart server and make sure the allowed list is the same standalone.restart() - limit_mechs = standalone.rootdse.supported_sasl() + limit_mechs = ensure_list_str(standalone.rootdse.supported_sasl()) assert('PLAIN' in limit_mechs) assert('EXTERNAL' in limit_mechs) assert('GSSAPI' not in limit_mechs) @@ -165,13 +165,13 @@ def test_basic_feature(topology_st): # check the supported list is the same as our first check. standalone.log.info("Check that we have the original set of mechanisms") - final_mechs = standalone.rootdse.supported_sasl() + final_mechs = ensure_list_str(standalone.rootdse.supported_sasl()) assert(set(final_mechs) == set(orig_mechs)) # Check it after a restart standalone.log.info("Check that we have the original set of mechanisms after a restart") standalone.restart() - final_mechs = standalone.rootdse.supported_sasl() + final_mechs = ensure_list_str(standalone.rootdse.supported_sasl()) assert(set(final_mechs) == set(orig_mechs)) -- 1.8.3.1