#49758 Issue 49588 - Add py3 support for tickets : part-3
Closed 3 years ago by spichugi. Opened 5 years ago by aadhikari.
aadhikari/389-ds-base python3-support-ticket-3  into  master

@@ -15,6 +15,7 @@ 

  from lib389._constants import *

  from lib389.properties import *

  from lib389.topologies import topology_st

+ from lib389.utils import *

  

  log = logging.getLogger(__name__)

  
@@ -95,7 +96,7 @@ 

          except ldap.ALREADY_EXISTS:

              log.debug("Entry %s already exists" % (member_DN))

  

-         replace = [(ldap.MOD_REPLACE, 'memberof', group_DN)]

+         replace = [(ldap.MOD_REPLACE, 'memberof', ensure_bytes(group_DN))]

          topology_st.standalone.modify_s(member_DN, replace)

  

          #
@@ -111,7 +112,7 @@ 

          assert len(ents) == 1

          ent = ents[0]

          # print ent

-         value = ent.getValue('memberof')

+         value = ensure_str(ent.getValue('memberof'))

          # print "memberof: %s" % (value)

          assert value == group_DN

  
@@ -165,7 +166,7 @@ 

      ent = ents[0]

      log.debug("Fixed entry %r\n" % ent)

  

-     if ent.getValue('memberof') == group_DN:

+     if ensure_str(ent.getValue('memberof')) == group_DN:

          log.warning("Error the fixupMemberOf did not fix %s" % (member_DN))

          result_successful = False

      else:

@@ -20,6 +20,7 @@ 

  from lib389 import Entry

  from lib389._constants import *

  from lib389.topologies import topology_m1c1

+ from lib389.utils import *

  

  logging.getLogger(__name__).setLevel(logging.DEBUG)

  log = logging.getLogger(__name__)
@@ -68,7 +69,7 @@ 

          may = MAY_OLD

  

      new_oc = "( %s  NAME '%s' DESC '%s' SUP %s AUXILIARY MUST %s MAY %s )" % (oid, name, desc, sup, must, may)

-     return new_oc

+     return ensure_bytes(new_oc)

  

  

  def add_OC(instance, oid_ext, name):
@@ -92,7 +93,7 @@ 

          trigger_schema_push.value += 1

      except AttributeError:

          trigger_schema_push.value = 1

-     replace = [(ldap.MOD_REPLACE, 'telephonenumber', str(trigger_schema_push.value))]

+     replace = [(ldap.MOD_REPLACE, 'telephonenumber', ensure_bytes(str(trigger_schema_push.value)))]

      topology_m1c1.ms["master1"].modify_s(ENTRY_DN, replace)

  

      # wait 10 seconds that the update is replicated

@@ -28,7 +28,7 @@ 

  

      # Enable Dynamic plugins, and the linked Attrs plugin

      try:

-         topology_st.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE, 'nsslapd-dynamic-plugins', 'on')])

+         topology_st.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE, 'nsslapd-dynamic-plugins', b'on')])

      except ldap.LDAPError as e:

          log.fatal('Failed to enable dynamic plugin!' + e.message['desc'])

          assert False

@@ -56,7 +56,7 @@ 

          may = MAY

  

      new_oc = "( %s  NAME '%s' DESC '%s' SUP %s AUXILIARY MUST %s MAY %s )" % (oid, name, desc, sup, must, may)

-     return new_oc

+     return ensure_bytes(new_oc)

  

  

  def test_ticket47653_init(topology_m2):
@@ -82,7 +82,7 @@ 

  

      if DEBUGGING:

          # enable acl error logging

-         mod = [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', str(128 + 8192))]  # ACL + REPL

+         mod = [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', ensure_bytes(str(128 + 8192)))]  # ACL + REPL

          topology_m2.ms["master1"].modify_s(DN_CONFIG, mod)

          topology_m2.ms["master2"].modify_s(DN_CONFIG, mod)

  
@@ -159,7 +159,7 @@ 

      ACI_ALLOW = "(version 3.0; acl \"SelfDN add\"; allow (add)"

      ACI_SUBJECT = " userattr = \"member#selfDN\";)"

      ACI_BODY = ACI_TARGET + ACI_TARGETFILTER + ACI_ALLOW + ACI_SUBJECT

-     mod = [(ldap.MOD_ADD, 'aci', ACI_BODY)]

+     mod = [(ldap.MOD_ADD, 'aci', ensure_bytes(ACI_BODY))]

      topology_m2.ms["master1"].modify_s(SUFFIX, mod)

      time.sleep(1)

  
@@ -215,7 +215,7 @@ 

  

      # Now update the entry on Master2 (as DM because 47653 is possibly not fixed on M2)

      topology_m2.ms["master1"].log.info("Update  %s on M2" % ENTRY_DN)

-     mod = [(ldap.MOD_REPLACE, 'description', 'test_add')]

+     mod = [(ldap.MOD_REPLACE, 'description', b'test_add')]

      topology_m2.ms["master2"].modify_s(ENTRY_DN, mod)

      time.sleep(1)

  
@@ -224,13 +224,13 @@ 

      while loop <= 10:

          try:

              ent = topology_m2.ms["master1"].getEntry(ENTRY_DN, ldap.SCOPE_BASE, "(objectclass=*)")

-             if ent.hasAttr('description') and (ent.getValue('description') == 'test_add'):

+             if ent.hasAttr('description') and (ensure_str(ent.getValue('description')) == 'test_add'):

                  break

          except ldap.NO_SUCH_OBJECT:

              time.sleep(1)

              loop += 1

  

-     assert ent.getValue('description') == 'test_add'

+     assert ensure_str(ent.getValue('description')) == 'test_add'

  

  

  def test_ticket47653_modify(topology_m2):
@@ -252,7 +252,7 @@ 

      # entry to modify WITH member being BIND_DN but WITHOUT the ACI -> ldap.INSUFFICIENT_ACCESS

      try:

          topology_m2.ms["master1"].log.info("Try to modify  %s (aci is missing)" % ENTRY_DN)

-         mod = [(ldap.MOD_REPLACE, 'postalCode', '9876')]

+         mod = [(ldap.MOD_REPLACE, 'postalCode', b'9876')]

          topology_m2.ms["master1"].modify_s(ENTRY_DN, mod)

      except Exception as e:

          topology_m2.ms["master1"].log.info("Exception (expected): %s" % type(e).__name__)
@@ -268,7 +268,7 @@ 

      ACI_ALLOW = "(version 3.0; acl \"SelfDN write\"; allow (write)"

      ACI_SUBJECT = " userattr = \"member#selfDN\";)"

      ACI_BODY = ACI_TARGET + ACI_TARGETATTR + ACI_TARGETFILTER + ACI_ALLOW + ACI_SUBJECT

-     mod = [(ldap.MOD_ADD, 'aci', ACI_BODY)]

+     mod = [(ldap.MOD_ADD, 'aci', ensure_bytes(ACI_BODY))]

      topology_m2.ms["master1"].modify_s(SUFFIX, mod)

      time.sleep(2)

  
@@ -279,7 +279,7 @@ 

  

      # modify the entry and checks the value

      topology_m2.ms["master1"].log.info("M1: Try to modify  %s. It should succeeds" % ENTRY_DN)

-     mod = [(ldap.MOD_REPLACE, 'postalCode', '1928')]

+     mod = [(ldap.MOD_REPLACE, 'postalCode', b'1928')]

      topology_m2.ms["master1"].modify_s(ENTRY_DN, mod)

  

      topology_m2.ms["master1"].log.info("M1: Bind as %s" % DN_DM)
@@ -288,7 +288,7 @@ 

      topology_m2.ms["master1"].log.info("M1: Check the update of %s" % ENTRY_DN)

      ents = topology_m2.ms["master1"].search_s(ENTRY_DN, ldap.SCOPE_BASE, 'objectclass=*')

      assert len(ents) == 1

-     assert ents[0].postalCode == '1928'

+     assert ensure_str(ents[0].postalCode) == '1928'

  

      # Now check the update has been replicated on M2

      topology_m2.ms["master1"].log.info("M2: Bind as %s" % DN_DM)
@@ -298,13 +298,13 @@ 

      while loop <= 10:

          try:

              ent = topology_m2.ms["master2"].getEntry(ENTRY_DN, ldap.SCOPE_BASE, "(objectclass=*)")

-             if ent.hasAttr('postalCode') and (ent.getValue('postalCode') == '1928'):

+             if ent.hasAttr('postalCode') and (ensure_str(ent.getValue('postalCode')) == '1928'):

                  break

          except ldap.NO_SUCH_OBJECT:

              time.sleep(1)

              loop += 1

      assert loop <= 10

-     assert ent.getValue('postalCode') == '1928'

+     assert ensure_str(ent.getValue('postalCode')) == '1928'

  

      # Now update the entry on Master2 bound as BIND_DN (update may fail if  47653 is  not fixed on M2)

      topology_m2.ms["master1"].log.info("M2: Update  %s (bound as %s)" % (ENTRY_DN, BIND_DN))
@@ -312,7 +312,7 @@ 

      time.sleep(1)

      fail = False

      try:

-         mod = [(ldap.MOD_REPLACE, 'postalCode', '1929')]

+         mod = [(ldap.MOD_REPLACE, 'postalCode', b'1929')]

          topology_m2.ms["master2"].modify_s(ENTRY_DN, mod)

          fail = False

      except ldap.INSUFFICIENT_ACCESS:
@@ -332,12 +332,12 @@ 

          while loop <= 10:

              try:

                  ent = topology_m2.ms["master1"].getEntry(ENTRY_DN, ldap.SCOPE_BASE, "(objectclass=*)")

-                 if ent.hasAttr('postalCode') and (ent.getValue('postalCode') == '1929'):

+                 if ent.hasAttr('postalCode') and (ensure_str(ent.getValue('postalCode')) == '1929'):

                      break

              except ldap.NO_SUCH_OBJECT:

                  time.sleep(1)

                  loop += 1

-         assert ent.getValue('postalCode') == '1929'

+         assert ensure_str(ent.getValue('postalCode')) == '1929'

  

  

  if __name__ == '__main__':

@@ -19,6 +19,7 @@ 

  from lib389 import Entry

  from lib389._constants import *

  from lib389.topologies import topology_m2

+ from lib389.replica import ReplicationManager

  

  logging.getLogger(__name__).setLevel(logging.DEBUG)

  from lib389.utils import *
@@ -66,8 +67,13 @@ 

          may = MAY

  

      new_oc = "( %s  NAME '%s' DESC '%s' SUP %s AUXILIARY MUST %s MAY %s )" % (oid, name, desc, sup, must, may)

-     return new_oc

+     return ensure_bytes(new_oc)

  

+ def replication_check(topology_m2):

+     repl = ReplicationManager(SUFFIX)

+     master1 = topology_m2.ms["master1"]

+     master2 = topology_m2.ms["master2"]

+     return repl.test_replication(master1, master2)

  

  def test_ticket47676_init(topology_m2):

      """
@@ -91,7 +97,7 @@ 

          'userpassword': BIND_PW})))

  

      # enable acl error logging

-     mod = [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', str(128 + 8192))]  # ACL + REPL

+     mod = [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', ensure_bytes(str(128 + 8192)))]  # ACL + REPL

      topology_m2.ms["master1"].modify_s(DN_CONFIG, mod)

      topology_m2.ms["master2"].modify_s(DN_CONFIG, mod)

  
@@ -138,31 +144,18 @@ 

      #

      topology_m2.ms["master2"].simple_bind_s(DN_DM, PASSWORD)

      topology_m2.ms["master1"].log.info("Try to retrieve %s from Master2" % ENTRY_DN)

-     loop = 0

-     while loop <= 10:

-         try:

-             ent = topology_m2.ms["master2"].getEntry(ENTRY_DN, ldap.SCOPE_BASE, "(objectclass=*)")

-             break

-         except ldap.NO_SUCH_OBJECT:

-             time.sleep(2)

-             loop += 1

-     assert loop <= 10

- 

+     replication_check(topology_m2)

+     ent = topology_m2.ms["master2"].getEntry(ENTRY_DN, ldap.SCOPE_BASE, "(objectclass=*)")

+     assert ent

      # Now update the entry on Master2 (as DM because 47676 is possibly not fixed on M2)

      topology_m2.ms["master1"].log.info("Update  %s on M2" % ENTRY_DN)

-     mod = [(ldap.MOD_REPLACE, 'description', 'test_add')]

+     mod = [(ldap.MOD_REPLACE, 'description', b'test_add')]

      topology_m2.ms["master2"].modify_s(ENTRY_DN, mod)

  

      topology_m2.ms["master1"].simple_bind_s(DN_DM, PASSWORD)

-     loop = 0

-     while loop <= 10:

-         ent = topology_m2.ms["master1"].getEntry(ENTRY_DN, ldap.SCOPE_BASE, "(objectclass=*)")

-         if ent.hasAttr('description') and (ent.getValue('description') == 'test_add'):

-             break

-         time.sleep(1)

-         loop += 1

- 

-     assert ent.getValue('description') == 'test_add'

+     replication_check(topology_m2)

+     ent = topology_m2.ms["master1"].getEntry(ENTRY_DN, ldap.SCOPE_BASE, "(objectclass=*)")

+     assert ensure_str(ent.getValue('description')) == 'test_add'

  

  

  def test_ticket47676_reject_action(topology_m2):
@@ -172,7 +165,7 @@ 

      topology_m2.ms["master2"].simple_bind_s(DN_DM, PASSWORD)

  

      # make master1 to refuse to push the schema if OC_NAME is present in consumer schema

-     mod = [(ldap.MOD_ADD, 'schemaUpdateObjectclassReject', '%s' % (OC_NAME))]  # ACL + REPL

+     mod = [(ldap.MOD_ADD, 'schemaUpdateObjectclassReject', ensure_bytes('%s' % (OC_NAME)))]  # ACL + REPL

      topology_m2.ms["master1"].modify_s(REPL_SCHEMA_POLICY_SUPPLIER, mod)

  

      # Restart is required to take into account that policy
@@ -197,20 +190,15 @@ 

  

      # Do an update of M1 so that M1 will try to push the schema

      topology_m2.ms["master1"].log.info("Update  %s on M1" % ENTRY_DN)

-     mod = [(ldap.MOD_REPLACE, 'description', 'test_reject')]

+     mod = [(ldap.MOD_REPLACE, 'description', b'test_reject')]

      topology_m2.ms["master1"].modify_s(ENTRY_DN, mod)

  

      # Check the replication occured and so also M1 attempted to push the schema

      topology_m2.ms["master1"].log.info("Check updated %s on M2" % ENTRY_DN)

-     loop = 0

-     while loop <= 10:

-         ent = topology_m2.ms["master2"].getEntry(ENTRY_DN, ldap.SCOPE_BASE, "(objectclass=*)", ['description'])

-         if ent.hasAttr('description') and ent.getValue('description') == 'test_reject':

-             # update was replicated

-             break

-         time.sleep(2)

-         loop += 1

-     assert loop <= 10

+ 

+     replication_check(topology_m2)

+     ent = topology_m2.ms["master2"].getEntry(ENTRY_DN, ldap.SCOPE_BASE, "(objectclass=*)", ['description'])

+     assert ensure_str(ent.getValue('description')) == 'test_reject'

  

      # Check that the schema has not been pushed

      topology_m2.ms["master1"].log.info("Check %s is not in M2" % OC2_NAME)
@@ -226,7 +214,7 @@ 

      topology_m2.ms["master1"].log.info("\n\n######################### NO MORE REJECT ACTION ######################\n")

  

      # make master1 to do no specific action on OC_NAME

-     mod = [(ldap.MOD_DELETE, 'schemaUpdateObjectclassReject', '%s' % (OC_NAME))]  # ACL + REPL

+     mod = [(ldap.MOD_DELETE, 'schemaUpdateObjectclassReject', ensure_bytes('%s' % (OC_NAME)))]  # ACL + REPL

      topology_m2.ms["master1"].modify_s(REPL_SCHEMA_POLICY_SUPPLIER, mod)

  

      # Restart is required to take into account that policy
@@ -235,21 +223,15 @@ 

  

      # Do an update of M1 so that M1 will try to push the schema

      topology_m2.ms["master1"].log.info("Update  %s on M1" % ENTRY_DN)

-     mod = [(ldap.MOD_REPLACE, 'description', 'test_no_more_reject')]

+     mod = [(ldap.MOD_REPLACE, 'description', b'test_no_more_reject')]

      topology_m2.ms["master1"].modify_s(ENTRY_DN, mod)

  

      # Check the replication occured and so also M1 attempted to push the schema

      topology_m2.ms["master1"].log.info("Check updated %s on M2" % ENTRY_DN)

-     loop = 0

-     while loop <= 10:

-         ent = topology_m2.ms["master2"].getEntry(ENTRY_DN, ldap.SCOPE_BASE, "(objectclass=*)", ['description'])

-         if ent.hasAttr('description') and ent.getValue('description') == 'test_no_more_reject':

-             # update was replicated

-             break

-         time.sleep(2)

-         loop += 1

-     assert loop <= 10

  

+     replication_check(topology_m2)

+     ent = topology_m2.ms["master2"].getEntry(ENTRY_DN, ldap.SCOPE_BASE, "(objectclass=*)", ['description'])

+     assert ensure_str(ent.getValue('description')) == 'test_no_more_reject'

      # Check that the schema has been pushed

      topology_m2.ms["master1"].log.info("Check %s is in M2" % OC2_NAME)

      ent = topology_m2.ms["master2"].getEntry(SCHEMA_DN, ldap.SCOPE_BASE, "(objectclass=*)", ["objectclasses"])

@@ -80,12 +80,12 @@ 

      topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)

  

      # Modify Account Policy config entry

-     topology_st.standalone.modify_s(ACCT_POLICY_CONFIG_DN, [(ldap.MOD_REPLACE, 'alwaysrecordlogin', 'yes'),

-                                                             (ldap.MOD_REPLACE, 'stateattrname', 'lastLoginTime'),

-                                                             (ldap.MOD_REPLACE, 'altstateattrname', 'createTimestamp'),

-                                                             (ldap.MOD_REPLACE, 'specattrname', 'acctPolicySubentry'),

+     topology_st.standalone.modify_s(ACCT_POLICY_CONFIG_DN, [(ldap.MOD_REPLACE, 'alwaysrecordlogin', b'yes'),

+                                                             (ldap.MOD_REPLACE, 'stateattrname', b'lastLoginTime'),

+                                                             (ldap.MOD_REPLACE, 'altstateattrname', b'createTimestamp'),

+                                                             (ldap.MOD_REPLACE, 'specattrname', b'acctPolicySubentry'),

                                                              (ldap.MOD_REPLACE, 'limitattrname',

-                                                              'accountInactivityLimit')])

+                                                              b'accountInactivityLimit')])

  

      # Enable the plugins

      topology_st.standalone.plugins.enable(name=PLUGIN_ACCT_POLICY)
@@ -96,7 +96,7 @@ 

      try:

          topology_st.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PW)

      except ldap.CONSTRAINT_VIOLATION as e:

-         log.error('CONSTRAINT VIOLATION ' + e.message['desc'])

+         log.error('CONSTRAINT VIOLATION {}'.format(e.args[0]['desc']))

  

      time.sleep(2)

  
@@ -109,7 +109,7 @@ 

      try:

          topology_st.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PW)

      except ldap.CONSTRAINT_VIOLATION as e:

-         log.error('CONSTRAINT VIOLATION ' + e.message['desc'])

+         log.error('CONSTRAINT VIOLATION {}'.format(e.args[0]['desc']))

  

      time.sleep(2)

  
@@ -125,7 +125,7 @@ 

  

      # Now, change the inactivity limit, because that should trigger the account to now be locked. This is possible because the check is "delayed" until the usage of the account.

  

-     topology_st.standalone.modify_s(ACCT_POLICY_DN, [(ldap.MOD_REPLACE, 'accountInactivityLimit', '1'),])

+     topology_st.standalone.modify_s(ACCT_POLICY_DN, [(ldap.MOD_REPLACE, 'accountInactivityLimit', b'1'),])

      time.sleep(2)

  

      entry = topology_st.standalone.search_s(ACCT_POLICY_DN, ldap.SCOPE_BASE, SEARCHFILTER)
@@ -137,13 +137,13 @@ 

      try:

          topology_st.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PW)

      except ldap.CONSTRAINT_VIOLATION as e:

-         log.info('CONSTRAINT VIOLATION ' + e.message['desc'])

+         log.info('CONSTRAINT VIOLATION {}'.format(e.args[0]['desc']))

          log.info("%s was successfully inactivated." % TEST_USER_DN)

          pass

  

      # Now reset the value high to prevent issues with the next test.

      topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)

-     topology_st.standalone.modify_s(ACCT_POLICY_DN, [(ldap.MOD_REPLACE, 'accountInactivityLimit', INACTIVITY_LIMIT),])

+     topology_st.standalone.modify_s(ACCT_POLICY_DN, [(ldap.MOD_REPLACE, 'accountInactivityLimit', ensure_bytes(INACTIVITY_LIMIT)),])

  

  

  def test_ticket47714_run_1(topology_st):
@@ -161,14 +161,14 @@ 

      topology_st.standalone.modify_s(TEST_USER_DN, [(ldap.MOD_DELETE, 'lastLoginTime', None)])

  

      # Modify Account Policy config entry

-     topology_st.standalone.modify_s(ACCT_POLICY_CONFIG_DN, [(ldap.MOD_REPLACE, 'alwaysrecordlogin', 'yes'),

-                                                             (ldap.MOD_REPLACE, 'stateattrname', 'bogus'),

-                                                             (ldap.MOD_REPLACE, 'altstateattrname', 'modifyTimestamp'),

+     topology_st.standalone.modify_s(ACCT_POLICY_CONFIG_DN, [(ldap.MOD_REPLACE, 'alwaysrecordlogin', b'yes'),

+                                                             (ldap.MOD_REPLACE, 'stateattrname', b'bogus'),

+                                                             (ldap.MOD_REPLACE, 'altstateattrname', b'modifyTimestamp'),

                                                              (

-                                                             ldap.MOD_REPLACE, 'alwaysRecordLoginAttr', 'lastLoginTime'),

-                                                             (ldap.MOD_REPLACE, 'specattrname', 'acctPolicySubentry'),

+                                                             ldap.MOD_REPLACE, 'alwaysRecordLoginAttr', b'lastLoginTime'),

+                                                             (ldap.MOD_REPLACE, 'specattrname', b'acctPolicySubentry'),

                                                              (ldap.MOD_REPLACE, 'limitattrname',

-                                                              'accountInactivityLimit')])

+                                                              b'accountInactivityLimit')])

  

      # Enable the plugins

      topology_st.standalone.plugins.enable(name=PLUGIN_ACCT_POLICY)
@@ -179,7 +179,7 @@ 

      try:

          topology_st.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PW)

      except ldap.CONSTRAINT_VIOLATION as e:

-         log.error('CONSTRAINT VIOLATION ' + e.message['desc'])

+         log.error('CONSTRAINT VIOLATION {}'.format(e.args[0]['desc']))

  

      time.sleep(1)

  
@@ -191,7 +191,7 @@ 

      try:

          topology_st.standalone.simple_bind_s(TEST_USER_DN, TEST_USER_PW)

      except ldap.CONSTRAINT_VIOLATION as e:

-         log.error('CONSTRAINT VIOLATION ' + e.message['desc'])

+         log.error('CONSTRAINT VIOLATION {}'.format(e.args[0]['desc']))

  

      time.sleep(1)

  

@@ -19,6 +19,8 @@ 

  from lib389 import Entry

  from lib389._constants import *

  from lib389.topologies import topology_m2

+ from lib389.replica import ReplicationManager

+ from lib389.utils import *

  

  logging.getLogger(__name__).setLevel(logging.DEBUG)

  log = logging.getLogger(__name__)
@@ -57,24 +59,29 @@ 

  def _add_custom_at_definition(name='ATticket47721'):

      new_at = "( %s-oid NAME '%s' DESC 'test AT ticket 47721' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN ( 'Test 47721' 'user defined' ) )" % (

      name, name)

-     return new_at

+     return ensure_bytes(new_at)

  

  

  def _chg_std_at_defintion():

      new_at = "( 2.16.840.1.113730.3.1.569 NAME 'cosPriority' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 X-ORIGIN 'Netscape Directory Server' )"

-     return new_at

+     return ensure_bytes(new_at)

  

  

  def _add_custom_oc_defintion(name='OCticket47721'):

      new_oc = "( %s-oid NAME '%s' DESC 'An group of related automount objects' SUP top STRUCTURAL MUST ou X-ORIGIN 'draft-howard-rfc2307bis' )" % (

      name, name)

-     return new_oc

+     return ensure_bytes(new_oc)

  

  

  def _chg_std_oc_defintion():

      new_oc = "( 5.3.6.1.1.1.2.0 NAME 'trustAccount' DESC 'Sets trust accounts information' SUP top AUXILIARY MUST trustModel MAY ( accessTo $ ou ) X-ORIGIN 'nss_ldap/pam_ldap' )"

-     return new_oc

+     return ensure_bytes(new_oc)

  

+ def replication_check(topology_m2):

+     repl = ReplicationManager(SUFFIX)

+     master1 = topology_m2.ms["master1"]

+     master2 = topology_m2.ms["master2"]

+     return repl.test_replication(master1, master2)

  

  def test_ticket47721_init(topology_m2):

      """
@@ -94,7 +101,7 @@ 

          'userpassword': BIND_PW})))

  

      # enable repl error logging

-     mod = [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', str(8192))]  # REPL logging

+     mod = [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', ensure_bytes(str(8192)))]  # REPL logging

      topology_m2.ms["master1"].modify_s(DN_CONFIG, mod)

      topology_m2.ms["master2"].modify_s(DN_CONFIG, mod)

  
@@ -109,17 +116,9 @@ 

  

  def test_ticket47721_0(topology_m2):

      dn = "cn=%s0,%s" % (OTHER_NAME, SUFFIX)

-     loop = 0

-     ent = None

-     while loop <= 10:

-         try:

-             ent = topology_m2.ms["master2"].getEntry(dn, ldap.SCOPE_BASE, "(objectclass=*)")

-             break

-         except ldap.NO_SUCH_OBJECT:

-             time.sleep(1)

-             loop += 1

-     if ent is None:

-         assert False

+     replication_check(topology_m2)

+     ent = topology_m2.ms["master2"].getEntry(dn, ldap.SCOPE_BASE, "(objectclass=*)")

+     assert ent

  

  

  def test_ticket47721_1(topology_m2):
@@ -143,20 +142,13 @@ 

      topology_m2.ms["master1"].log.info("Chg (M2) %s " % new)

      topology_m2.ms["master2"].schema.add_schema('objectClasses', new)

  

-     mod = [(ldap.MOD_REPLACE, 'description', 'Hello world 1')]

+     mod = [(ldap.MOD_REPLACE, 'description', b'Hello world 1')]

      dn = "cn=%s0,%s" % (OTHER_NAME, SUFFIX)

      topology_m2.ms["master2"].modify_s(dn, mod)

  

-     loop = 0

-     while loop <= 10:

-         try:

-             ent = topology_m2.ms["master1"].getEntry(dn, ldap.SCOPE_BASE, "(objectclass=*)")

-             if ent.hasAttr('description') and (ent.getValue('description') == 'Hello world 1'):

-                 break

-         except ldap.NO_SUCH_OBJECT:

-             loop += 1

-         time.sleep(1)

-     assert loop <= 10

+     replication_check(topology_m2)

+     ent = topology_m2.ms["master1"].getEntry(dn, ldap.SCOPE_BASE, "(objectclass=*)")

+     assert ensure_str(ent.getValue('description')) == 'Hello world 1'

  

      time.sleep(2)

      schema_csn_master1 = topology_m2.ms["master1"].schema.get_schema_csn()
@@ -168,20 +160,13 @@ 

  def test_ticket47721_2(topology_m2):

      log.info('Running test 2...')

  

-     mod = [(ldap.MOD_REPLACE, 'description', 'Hello world 2')]

+     mod = [(ldap.MOD_REPLACE, 'description', b'Hello world 2')]

      dn = "cn=%s0,%s" % (OTHER_NAME, SUFFIX)

      topology_m2.ms["master1"].modify_s(dn, mod)

  

-     loop = 0

-     while loop <= 10:

-         try:

-             ent = topology_m2.ms["master2"].getEntry(dn, ldap.SCOPE_BASE, "(objectclass=*)")

-             if ent.hasAttr('description') and (ent.getValue('description') == 'Hello world 2'):

-                 break

-         except ldap.NO_SUCH_OBJECT:

-             loop += 1

-         time.sleep(1)

-     assert loop <= 10

+     replication_check(topology_m2)

+     ent = topology_m2.ms["master2"].getEntry(dn, ldap.SCOPE_BASE, "(objectclass=*)")

+     assert ensure_str(ent.getValue('description')) == 'Hello world 2'

  

      time.sleep(2)

      schema_csn_master1 = topology_m2.ms["master1"].schema.get_schema_csn()
@@ -222,20 +207,13 @@ 

      topology_m2.ms["master2"].schema.add_schema('objectClasses', new)

      time.sleep(1)

  

-     mod = [(ldap.MOD_REPLACE, 'description', 'Hello world 3')]

+     mod = [(ldap.MOD_REPLACE, 'description', b'Hello world 3')]

      dn = "cn=%s0,%s" % (OTHER_NAME, SUFFIX)

      topology_m2.ms["master1"].modify_s(dn, mod)

  

-     loop = 0

-     while loop <= 10:

-         try:

-             ent = topology_m2.ms["master2"].getEntry(dn, ldap.SCOPE_BASE, "(objectclass=*)")

-             if ent.hasAttr('description') and (ent.getValue('description') == 'Hello world 3'):

-                 break

-         except ldap.NO_SUCH_OBJECT:

-             loop += 1

-         time.sleep(1)

-     assert loop <= 10

+     replication_check(topology_m2)

+     ent = topology_m2.ms["master2"].getEntry(dn, ldap.SCOPE_BASE, "(objectclass=*)")

+     assert ensure_str(ent.getValue('description')) == 'Hello world 3'

  

      time.sleep(5)

      schema_csn_master1 = topology_m2.ms["master1"].schema.get_schema_csn()
@@ -273,36 +251,22 @@ 

      topology_m2.ms["master1"].schema.add_schema('objectClasses', new)

  

      topology_m2.ms["master1"].log.info("trigger replication M1->M2: to update the schema")

-     mod = [(ldap.MOD_REPLACE, 'description', 'Hello world 4')]

+     mod = [(ldap.MOD_REPLACE, 'description', b'Hello world 4')]

      dn = "cn=%s0,%s" % (OTHER_NAME, SUFFIX)

      topology_m2.ms["master1"].modify_s(dn, mod)

  

-     loop = 0

-     while loop <= 10:

-         try:

-             ent = topology_m2.ms["master2"].getEntry(dn, ldap.SCOPE_BASE, "(objectclass=*)")

-             if ent.hasAttr('description') and (ent.getValue('description') == 'Hello world 4'):

-                 break

-         except ldap.NO_SUCH_OBJECT:

-             loop += 1

-         time.sleep(1)

-     assert loop <= 10

+     replication_check(topology_m2)

+     ent = topology_m2.ms["master2"].getEntry(dn, ldap.SCOPE_BASE, "(objectclass=*)")

+     assert ensure_str(ent.getValue('description')) == 'Hello world 4'

  

      topology_m2.ms["master1"].log.info("trigger replication M1->M2: to push the schema")

-     mod = [(ldap.MOD_REPLACE, 'description', 'Hello world 5')]

+     mod = [(ldap.MOD_REPLACE, 'description', b'Hello world 5')]

      dn = "cn=%s0,%s" % (OTHER_NAME, SUFFIX)

      topology_m2.ms["master1"].modify_s(dn, mod)

  

-     loop = 0

-     while loop <= 10:

-         try:

-             ent = topology_m2.ms["master2"].getEntry(dn, ldap.SCOPE_BASE, "(objectclass=*)")

-             if ent.hasAttr('description') and (ent.getValue('description') == 'Hello world 5'):

-                 break

-         except ldap.NO_SUCH_OBJECT:

-             loop += 1

-         time.sleep(1)

-     assert loop <= 10

+     replication_check(topology_m2)

+     ent = topology_m2.ms["master2"].getEntry(dn, ldap.SCOPE_BASE, "(objectclass=*)")

+     assert ensure_str(ent.getValue('description')) == 'Hello world 5'

  

      time.sleep(2)

      schema_csn_master1 = topology_m2.ms["master1"].schema.get_schema_csn()

@@ -11,6 +11,7 @@ 

  import pytest

  from lib389.tasks import *

  from lib389.topologies import topology_st

+ from lib389.replica import ReplicationManager

  

  from lib389._constants import (defaultProperties, DEFAULT_SUFFIX, ReplicaRole,

                                 REPLICAID_MASTER_1, REPLICATION_BIND_DN, REPLICATION_BIND_PW,
@@ -28,12 +29,9 @@ 

  

      log.info('Testing Ticket 47781 - Testing for deadlock after importing LDIF with replication data')

  

-     #

-     # Setup Replication

-     #

-     log.info('Setting up replication...')

-     topology_st.standalone.replica.enableReplication(suffix=DEFAULT_SUFFIX, role=ReplicaRole.MASTER,

-                                                      replicaId=REPLICAID_MASTER_1)

+     master = topology_st.standalone

+     repl = ReplicationManager(DEFAULT_SUFFIX)

+     repl.create_first_master(master)

  

      properties = {RA_NAME: r'meTo_$host:$port',

                    RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
@@ -41,77 +39,59 @@ 

                    RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],

                    RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}

      # The agreement should point to a server that does NOT exist (invalid port)

-     repl_agreement = topology_st.standalone.agreement.create(suffix=DEFAULT_SUFFIX,

-                                                              host=topology_st.standalone.host,

-                                                              port=5555,

-                                                              properties=properties)

+     repl_agreement = master.agreement.create(suffix=DEFAULT_SUFFIX,

+                                              host=master.host,

+                                              port=5555,

+                                              properties=properties)

  

      #

      # add two entries

      #

      log.info('Adding two entries...')

-     try:

-         topology_st.standalone.add_s(Entry(('cn=entry1,dc=example,dc=com', {

-             'objectclass': 'top person'.split(),

-             'sn': 'user',

-             'cn': 'entry1'})))

-     except ldap.LDAPError as e:

-         log.error('Failed to add entry 1: ' + e.message['desc'])

-         assert False

- 

-     try:

-         topology_st.standalone.add_s(Entry(('cn=entry2,dc=example,dc=com', {

-             'objectclass': 'top person'.split(),

-             'sn': 'user',

-             'cn': 'entry2'})))

-     except ldap.LDAPError as e:

-         log.error('Failed to add entry 2: ' + e.message['desc'])

-         assert False

+ 

+     master.add_s(Entry(('cn=entry1,dc=example,dc=com', {

+         'objectclass': 'top person'.split(),

+         'sn': 'user',

+         'cn': 'entry1'})))

+ 

+     master.add_s(Entry(('cn=entry2,dc=example,dc=com', {

+         'objectclass': 'top person'.split(),

+         'sn': 'user',

+         'cn': 'entry2'})))

  

      #

      # export the replication ldif

      #

      log.info('Exporting replication ldif...')

      args = {EXPORT_REPL_INFO: True}

-     exportTask = Tasks(topology_st.standalone)

-     try:

-         exportTask.exportLDIF(DEFAULT_SUFFIX, None, "/tmp/export.ldif", args)

-     except ValueError:

-         assert False

+     exportTask = Tasks(master)

+     exportTask.exportLDIF(DEFAULT_SUFFIX, None, "/tmp/export.ldif", args)

  

      #

      # Restart the server

      #

      log.info('Restarting server...')

-     topology_st.standalone.stop()

-     topology_st.standalone.start()

+     master.stop()

+     master.start()

  

      #

      # Import the ldif

      #

      log.info('Import replication LDIF file...')

-     importTask = Tasks(topology_st.standalone)

+     importTask = Tasks(master)

      args = {TASK_WAIT: True}

-     try:

-         importTask.importLDIF(DEFAULT_SUFFIX, None, "/tmp/export.ldif", args)

-         os.remove("/tmp/export.ldif")

-     except ValueError:

-         os.remove("/tmp/export.ldif")

-         assert False

+     importTask.importLDIF(DEFAULT_SUFFIX, None, "/tmp/export.ldif", args)

+     os.remove("/tmp/export.ldif")

  

      #

      # Search for tombstones - we should not hang/timeout

      #

      log.info('Search for tombstone entries(should find one and not hang)...')

-     topology_st.standalone.set_option(ldap.OPT_NETWORK_TIMEOUT, 5)

-     topology_st.standalone.set_option(ldap.OPT_TIMEOUT, 5)

-     try:

-         entries = topology_st.standalone.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE, 'objectclass=nsTombstone')

-         if not entries:

-             log.fatal('Search failed to find any entries.')

-             assert PR_False

-     except ldap.LDAPError as e:

-         log.fatal('Search failed: ' + e.message['desc'])

+     master.set_option(ldap.OPT_NETWORK_TIMEOUT, 5)

+     master.set_option(ldap.OPT_TIMEOUT, 5)

+     entries = master.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE, 'objectclass=nsTombstone')

+     if not entries:

+         log.fatal('Search failed to find any entries.')

          assert PR_False

  

  

@@ -20,6 +20,7 @@ 

  from lib389 import Entry

  from lib389._constants import *

  from lib389.topologies import topology_m2

+ from lib389.utils import *

  

  logging.getLogger(__name__).setLevel(logging.DEBUG)

  log = logging.getLogger(__name__)
@@ -187,7 +188,7 @@ 

      for ent in ents:

          if ent.hasAttr(attr):

              for val in ent.getValues(attr):

-                 if val == value:

+                 if ensure_str(val) == value:

                      instance.log.debug("tombstone found: %r" % ent)

                      return ent

      return None
@@ -198,12 +199,13 @@ 

  

      # delete the entry

      instance.delete_s(entry_dn)

-     assert _find_tombstone(instance, SUFFIX, 'sn', name) is not None

+     ent = _find_tombstone(instance, SUFFIX, 'sn', name)

+     assert ent is not None

  

  

  def _mod_entry(instance, entry_dn, attr, value):

      instance.log.info("\n\n######################### MOD %s (M2) ######################\n" % entry_dn)

-     mod = [(ldap.MOD_REPLACE, attr, value)]

+     mod = [(ldap.MOD_REPLACE, attr, ensure_bytes(value))]

      instance.modify_s(entry_dn, mod)

  

  
@@ -262,7 +264,7 @@ 

      while loop <= 10:

          attr = 'description'

          value = 'test_value_%d' % loop

-         mod = [(ldap.MOD_REPLACE, attr, value)]

+         mod = [(ldap.MOD_REPLACE, attr, ensure_bytes(value))]

          topology_m2.ms["master1"].modify_s(entry_dn, mod)

          _check_mod_received(topology_m2.ms["master2"], SUFFIX, filt, attr, value)

          loop += 1
@@ -272,7 +274,7 @@ 

      while loop <= 10:

          attr = 'description'

          value = 'test_value_%d' % loop

-         mod = [(ldap.MOD_REPLACE, attr, value)]

+         mod = [(ldap.MOD_REPLACE, attr, ensure_bytes(value))]

          topology_m2.ms["master2"].modify_s(entry_dn, mod)

          _check_mod_received(topology_m2.ms["master1"], SUFFIX, filt, attr, value)

          loop += 1
@@ -312,7 +314,7 @@ 

          'description': "production DIT"})))

  

      # enable replication error logging

-     mod = [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', '8192')]

+     mod = [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', b'8192')]

      topology_m2.ms["master1"].modify_s(DN_CONFIG, mod)

      topology_m2.ms["master2"].modify_s(DN_CONFIG, mod)

  
@@ -414,7 +416,7 @@ 

      assert loop <= 10

      assert ent

      assert ent.hasAttr(attr)

-     assert ent.getValue(attr) == value

+     assert ensure_str(ent.getValue(attr)) == value

  

  

  if __name__ == '__main__':

@@ -13,6 +13,7 @@ 

  from lib389 import Entry

  from lib389._constants import *

  from lib389.topologies import topology_st

+ from lib389.utils import *

  

  log = logging.getLogger(__name__)

  
@@ -36,8 +37,8 @@ 

      topology_st.standalone.log.info("\n\n######################### SETUP ATTR UNIQ PLUGIN ######################\n")

  

      # enable attribute uniqueness plugin

-     mod = [(ldap.MOD_REPLACE, 'nsslapd-pluginEnabled', 'on'), (ldap.MOD_REPLACE, 'nsslapd-pluginarg0', 'sn'),

-            (ldap.MOD_REPLACE, 'nsslapd-pluginarg1', SUFFIX)]

+     mod = [(ldap.MOD_REPLACE, 'nsslapd-pluginEnabled', b'on'), (ldap.MOD_REPLACE, 'nsslapd-pluginarg0', b'sn'),

+            (ldap.MOD_REPLACE, 'nsslapd-pluginarg1', ensure_bytes(SUFFIX))]

      topology_st.standalone.modify_s(ATTRIBUTE_UNIQUENESS_PLUGIN, mod)

  

      topology_st.standalone.log.info("\n\n######################### ADD USER 1 ######################\n")

@@ -11,6 +11,7 @@ 

  import pytest

  from lib389.tasks import *

  from lib389.topologies import topology_st

+ from lib389.replica import ReplicationManager

  

  from lib389._constants import (defaultProperties, DEFAULT_SUFFIX, ReplicaRole,

                                 REPLICAID_MASTER_1, REPLICA_PRECISE_PURGING, REPLICA_PURGE_DELAY,
@@ -38,9 +39,10 @@ 

      #

      # Setup Replication

      #

-     log.info('Setting up replication...')

-     topology_st.standalone.replica.enableReplication(suffix=DEFAULT_SUFFIX, role=ReplicaRole.MASTER,

-                                                      replicaId=REPLICAID_MASTER_1)

+     master = topology_st.standalone

+     repl = ReplicationManager(DEFAULT_SUFFIX)

+     repl.create_first_master(master)

+     repl.ensure_agreement(master, master)

  

      #

      # Part 1 create a tombstone entry and make sure nsTombstoneCSN is added
@@ -190,9 +192,9 @@ 

      #

      log.info('Part 4:  test tombstone purging...')

  

-     args = {REPLICA_PRECISE_PURGING: 'on',

-             REPLICA_PURGE_DELAY: '5',

-             REPLICA_PURGE_INTERVAL: '5'}

+     args = {REPLICA_PRECISE_PURGING: b'on',

+             REPLICA_PURGE_DELAY: b'5',

+             REPLICA_PURGE_INTERVAL: b'5'}

      try:

          topology_st.standalone.replica.setProperties(DEFAULT_SUFFIX, None, None, args)

      except:

@@ -201,7 +201,7 @@ 

          'cn': ACTIVE_USER_2_CN})))

  

      try:

-         topology_st.standalone.modify_s(ACTIVE_USER_2_DN, [(ldap.MOD_ADD, 'cn', ACTIVE_USER_1_CN)])

+         topology_st.standalone.modify_s(ACTIVE_USER_2_DN, [(ldap.MOD_ADD, 'cn', ensure_bytes(ACTIVE_USER_1_CN))])

      except ldap.CONSTRAINT_VIOLATION:

          # yes it is expected

          pass
@@ -209,7 +209,7 @@ 

      topology_st.standalone.log.info('Uniqueness enforced: checks MOD REPLACE entry is rejected')

      try:

          topology_st.standalone.modify_s(ACTIVE_USER_2_DN,

-                                         [(ldap.MOD_REPLACE, 'cn', [ACTIVE_USER_1_CN, ACTIVE_USER_2_CN])])

+                                         [(ldap.MOD_REPLACE, 'cn', [ensure_bytes(ACTIVE_USER_1_CN), ensure_bytes(ACTIVE_USER_2_CN)])])

      except ldap.CONSTRAINT_VIOLATION:

          # yes it is expected

          pass
@@ -316,7 +316,7 @@ 

      try:

  

          # modify add same value

-         topology_st.standalone.modify_s(STAGE_USER_1_DN, [(ldap.MOD_ADD, 'cn', [ACTIVE_USER_2_CN])])

+         topology_st.standalone.modify_s(STAGE_USER_1_DN, [(ldap.MOD_ADD, 'cn', [ensure_bytes(ACTIVE_USER_2_CN)])])

      except ldap.CONSTRAINT_VIOLATION:

          assert across_subtrees

  
@@ -328,7 +328,7 @@ 

      try:

          # modify replace same value

          topology_st.standalone.modify_s(STAGE_USER_1_DN,

-                                         [(ldap.MOD_REPLACE, 'cn', [STAGE_USER_2_CN, ACTIVE_USER_1_CN])])

+                                         [(ldap.MOD_REPLACE, 'cn', [ensure_bytes(STAGE_USER_2_CN), ensure_bytes(ACTIVE_USER_1_CN)])])

      except ldap.CONSTRAINT_VIOLATION:

          assert across_subtrees

  
@@ -371,7 +371,7 @@ 

          assert stage_ent.hasAttr('cn')

          found = False

          for value in stage_ent.getValues('cn'):

-             if value == 'dummy':

+             if ensure_str(value) == 'dummy':

                  found = True

          assert found

  
@@ -380,7 +380,7 @@ 

          assert active_ent.hasAttr('cn')

          found = False

          for value in stage_ent.getValues('cn'):

-             if value == 'dummy':

+             if ensure_str(value) == 'dummy':

                  found = True

          assert found

  
@@ -607,7 +607,7 @@ 

      topology_st.standalone.getEntry(config.dn, ldap.SCOPE_BASE, "(objectclass=nsSlapdPlugin)", ALL_CONFIG_ATTRS)

  

      # Check the server did not restart

-     topology_st.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', '65536')])

+     topology_st.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', b'65536')])

      try:

          topology_st.standalone.restart()

          ent = topology_st.standalone.getEntry(config.dn, ldap.SCOPE_BASE, "(objectclass=nsSlapdPlugin)",
@@ -715,7 +715,7 @@ 

      topology_st.standalone.getEntry(config.dn, ldap.SCOPE_BASE, "(objectclass=nsSlapdPlugin)", ALL_CONFIG_ATTRS)

  

      # Check the server did not restart

-     topology_st.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', '65536')])

+     topology_st.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', b'65536')])

      try:

          topology_st.standalone.restart()

          ent = topology_st.standalone.getEntry(config.dn, ldap.SCOPE_BASE, "(objectclass=nsSlapdPlugin)",
@@ -917,7 +917,7 @@ 

      config = _build_config(topology_st, attr_name='cn', subtree_1="this_is dummy DN", subtree_2="an other=dummy DN",

                             type_config='new', across_subtrees=False)

  

-     topology_st.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', '65536')])

+     topology_st.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', b'65536')])

      # replace 'cn' uniqueness entry

      try:

          topology_st.standalone.delete_s(config.dn)

@@ -81,8 +81,8 @@ 

                                   ALLOCATED_ATTR: str(-1)})))

      ent = topology_st.standalone.getEntry(ACTIVE_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")

      assert ent.hasAttr(ALLOCATED_ATTR)

-     assert ent.getValue(ALLOCATED_ATTR) != str(-1)

-     topology_st.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))

+     assert ensure_str(ent.getValue(ALLOCATED_ATTR)) != str(-1)

+     topology_st.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ensure_str(ent.getValue(ALLOCATED_ATTR))))

      topology_st.standalone.delete_s(ACTIVE_USER1_DN)

  

  
@@ -99,8 +99,8 @@ 

                                   ALLOCATED_ATTR: str(20)})))

      ent = topology_st.standalone.getEntry(ACTIVE_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")

      assert ent.hasAttr(ALLOCATED_ATTR)

-     assert ent.getValue(ALLOCATED_ATTR) == str(20)

-     topology_st.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))

+     assert ensure_str(ent.getValue(ALLOCATED_ATTR)) == str(20)

+     topology_st.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ensure_str(ent.getValue(ALLOCATED_ATTR))))

      topology_st.standalone.delete_s(ACTIVE_USER1_DN)

  

  
@@ -117,8 +117,8 @@ 

                                   ALLOCATED_ATTR: str(-1)})))

      ent = topology_st.standalone.getEntry(STAGED_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")

      assert ent.hasAttr(ALLOCATED_ATTR)

-     assert ent.getValue(ALLOCATED_ATTR) != str(-1)

-     topology_st.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))

+     assert ensure_str(ent.getValue(ALLOCATED_ATTR)) != str(-1)

+     topology_st.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ensure_str(ent.getValue(ALLOCATED_ATTR))))

      topology_st.standalone.delete_s(STAGED_USER1_DN)

  

  
@@ -135,8 +135,8 @@ 

                                   ALLOCATED_ATTR: str(20)})))

      ent = topology_st.standalone.getEntry(STAGED_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")

      assert ent.hasAttr(ALLOCATED_ATTR)

-     assert ent.getValue(ALLOCATED_ATTR) == str(20)

-     topology_st.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))

+     assert ensure_str(ent.getValue(ALLOCATED_ATTR)) == str(20)

+     topology_st.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ensure_str(ent.getValue(ALLOCATED_ATTR))))

      topology_st.standalone.delete_s(STAGED_USER1_DN)

  

  
@@ -147,7 +147,7 @@ 

      _header(topology_st, 'Exclude the provisioning container')

  

      dn_config = "cn=excluded scope, cn=%s, %s" % (PLUGIN_DNA, DN_PLUGIN)

-     mod = [(ldap.MOD_REPLACE, 'dnaExcludeScope', PROVISIONING)]

+     mod = [(ldap.MOD_REPLACE, 'dnaExcludeScope', ensure_bytes(PROVISIONING))]

      topology_st.standalone.modify_s(dn_config, mod)

  

  
@@ -164,8 +164,8 @@ 

                                   ALLOCATED_ATTR: str(-1)})))

      ent = topology_st.standalone.getEntry(ACTIVE_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")

      assert ent.hasAttr(ALLOCATED_ATTR)

-     assert ent.getValue(ALLOCATED_ATTR) != str(-1)

-     topology_st.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))

+     assert ensure_str(ensure_str(ent.getValue(ALLOCATED_ATTR))) != str(-1)

+     topology_st.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ensure_str(ensure_str(ent.getValue(ALLOCATED_ATTR)))))

      topology_st.standalone.delete_s(ACTIVE_USER1_DN)

  

  
@@ -183,8 +183,8 @@ 

                                   ALLOCATED_ATTR: str(20)})))

      ent = topology_st.standalone.getEntry(ACTIVE_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")

      assert ent.hasAttr(ALLOCATED_ATTR)

-     assert ent.getValue(ALLOCATED_ATTR) == str(20)

-     topology_st.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))

+     assert ensure_str(ensure_str(ent.getValue(ALLOCATED_ATTR))) == str(20)

+     topology_st.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ensure_str(ensure_str(ent.getValue(ALLOCATED_ATTR)))))

      topology_st.standalone.delete_s(ACTIVE_USER1_DN)

  

  
@@ -201,8 +201,8 @@ 

                                   ALLOCATED_ATTR: str(-1)})))

      ent = topology_st.standalone.getEntry(STAGED_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")

      assert ent.hasAttr(ALLOCATED_ATTR)

-     assert ent.getValue(ALLOCATED_ATTR) == str(-1)

-     topology_st.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))

+     assert ensure_str(ent.getValue(ALLOCATED_ATTR)) == str(-1)

+     topology_st.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ensure_str(ent.getValue(ALLOCATED_ATTR))))

      topology_st.standalone.delete_s(STAGED_USER1_DN)

  

  
@@ -220,8 +220,8 @@ 

                                   ALLOCATED_ATTR: str(20)})))

      ent = topology_st.standalone.getEntry(STAGED_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")

      assert ent.hasAttr(ALLOCATED_ATTR)

-     assert ent.getValue(ALLOCATED_ATTR) == str(20)

-     topology_st.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))

+     assert ensure_str(ent.getValue(ALLOCATED_ATTR)) == str(20)

+     topology_st.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ensure_str(ent.getValue(ALLOCATED_ATTR))))

      topology_st.standalone.delete_s(STAGED_USER1_DN)

  

  
@@ -238,8 +238,8 @@ 

                                  ALLOCATED_ATTR: str(-1)})))

      ent = topology_st.standalone.getEntry(DUMMY_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")

      assert ent.hasAttr(ALLOCATED_ATTR)

-     assert ent.getValue(ALLOCATED_ATTR) != str(-1)

-     topology_st.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))

+     assert ensure_str(ent.getValue(ALLOCATED_ATTR)) != str(-1)

+     topology_st.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ensure_str(ent.getValue(ALLOCATED_ATTR))))

      topology_st.standalone.delete_s(DUMMY_USER1_DN)

  

  
@@ -257,8 +257,8 @@ 

                                  ALLOCATED_ATTR: str(20)})))

      ent = topology_st.standalone.getEntry(DUMMY_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")

      assert ent.hasAttr(ALLOCATED_ATTR)

-     assert ent.getValue(ALLOCATED_ATTR) == str(20)

-     topology_st.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))

+     assert ensure_str(ent.getValue(ALLOCATED_ATTR)) == str(20)

+     topology_st.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ensure_str(ent.getValue(ALLOCATED_ATTR))))

      topology_st.standalone.delete_s(DUMMY_USER1_DN)

  

  
@@ -269,7 +269,7 @@ 

      _header(topology_st, 'Exclude (in addition) the dummy container')

  

      dn_config = "cn=excluded scope, cn=%s, %s" % (PLUGIN_DNA, DN_PLUGIN)

-     mod = [(ldap.MOD_ADD, 'dnaExcludeScope', DUMMY_CONTAINER)]

+     mod = [(ldap.MOD_ADD, 'dnaExcludeScope', ensure_bytes(DUMMY_CONTAINER))]

      topology_st.standalone.modify_s(dn_config, mod)

  

  
@@ -286,8 +286,8 @@ 

                                   ALLOCATED_ATTR: str(-1)})))

      ent = topology_st.standalone.getEntry(ACTIVE_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")

      assert ent.hasAttr(ALLOCATED_ATTR)

-     assert ent.getValue(ALLOCATED_ATTR) != str(-1)

-     topology_st.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))

+     assert ensure_str(ent.getValue(ALLOCATED_ATTR)) != str(-1)

+     topology_st.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ensure_str(ent.getValue(ALLOCATED_ATTR))))

      topology_st.standalone.delete_s(ACTIVE_USER1_DN)

  

  
@@ -305,8 +305,8 @@ 

                                   ALLOCATED_ATTR: str(20)})))

      ent = topology_st.standalone.getEntry(ACTIVE_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")

      assert ent.hasAttr(ALLOCATED_ATTR)

-     assert ent.getValue(ALLOCATED_ATTR) == str(20)

-     topology_st.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))

+     assert ensure_str(ent.getValue(ALLOCATED_ATTR)) == str(20)

+     topology_st.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ensure_str(ent.getValue(ALLOCATED_ATTR))))

      topology_st.standalone.delete_s(ACTIVE_USER1_DN)

  

  
@@ -324,8 +324,8 @@ 

                                   ALLOCATED_ATTR: str(-1)})))

      ent = topology_st.standalone.getEntry(STAGED_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")

      assert ent.hasAttr(ALLOCATED_ATTR)

-     assert ent.getValue(ALLOCATED_ATTR) == str(-1)

-     topology_st.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))

+     assert ensure_str(ent.getValue(ALLOCATED_ATTR)) == str(-1)

+     topology_st.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ensure_str(ent.getValue(ALLOCATED_ATTR))))

      topology_st.standalone.delete_s(STAGED_USER1_DN)

  

  
@@ -343,8 +343,8 @@ 

                                   ALLOCATED_ATTR: str(20)})))

      ent = topology_st.standalone.getEntry(STAGED_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")

      assert ent.hasAttr(ALLOCATED_ATTR)

-     assert ent.getValue(ALLOCATED_ATTR) == str(20)

-     topology_st.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))

+     assert ensure_str(ent.getValue(ALLOCATED_ATTR)) == str(20)

+     topology_st.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ensure_str(ent.getValue(ALLOCATED_ATTR))))

      topology_st.standalone.delete_s(STAGED_USER1_DN)

  

  
@@ -362,8 +362,8 @@ 

                                  ALLOCATED_ATTR: str(-1)})))

      ent = topology_st.standalone.getEntry(DUMMY_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")

      assert ent.hasAttr(ALLOCATED_ATTR)

-     assert ent.getValue(ALLOCATED_ATTR) == str(-1)

-     topology_st.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))

+     assert ensure_str(ent.getValue(ALLOCATED_ATTR)) == str(-1)

+     topology_st.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ensure_str(ent.getValue(ALLOCATED_ATTR))))

      topology_st.standalone.delete_s(DUMMY_USER1_DN)

  

  
@@ -381,8 +381,8 @@ 

                                  ALLOCATED_ATTR: str(20)})))

      ent = topology_st.standalone.getEntry(DUMMY_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")

      assert ent.hasAttr(ALLOCATED_ATTR)

-     assert ent.getValue(ALLOCATED_ATTR) == str(20)

-     topology_st.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))

+     assert ensure_str(ent.getValue(ALLOCATED_ATTR)) == str(20)

+     topology_st.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ensure_str(ent.getValue(ALLOCATED_ATTR))))

      topology_st.standalone.delete_s(DUMMY_USER1_DN)

  

  
@@ -393,10 +393,10 @@ 

      _header(topology_st, 'Exclude PROVISIONING and a wrong container')

  

      dn_config = "cn=excluded scope, cn=%s, %s" % (PLUGIN_DNA, DN_PLUGIN)

-     mod = [(ldap.MOD_REPLACE, 'dnaExcludeScope', PROVISIONING)]

+     mod = [(ldap.MOD_REPLACE, 'dnaExcludeScope', ensure_bytes(PROVISIONING))]

      topology_st.standalone.modify_s(dn_config, mod)

      try:

-         mod = [(ldap.MOD_ADD, 'dnaExcludeScope', "invalidDN,%s" % SUFFIX)]

+         mod = [(ldap.MOD_ADD, 'dnaExcludeScope', ensure_bytes("invalidDN,%s" % SUFFIX))]

          topology_st.standalone.modify_s(dn_config, mod)

          raise ValueError("invalid dnaExcludeScope value (not a DN)")

      except ldap.INVALID_SYNTAX:
@@ -417,8 +417,8 @@ 

                                   ALLOCATED_ATTR: str(-1)})))

      ent = topology_st.standalone.getEntry(ACTIVE_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")

      assert ent.hasAttr(ALLOCATED_ATTR)

-     assert ent.getValue(ALLOCATED_ATTR) != str(-1)

-     topology_st.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))

+     assert ensure_str(ent.getValue(ALLOCATED_ATTR)) != str(-1)

+     topology_st.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ensure_str(ent.getValue(ALLOCATED_ATTR))))

      topology_st.standalone.delete_s(ACTIVE_USER1_DN)

  

  
@@ -436,8 +436,8 @@ 

                                   ALLOCATED_ATTR: str(20)})))

      ent = topology_st.standalone.getEntry(ACTIVE_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")

      assert ent.hasAttr(ALLOCATED_ATTR)

-     assert ent.getValue(ALLOCATED_ATTR) == str(20)

-     topology_st.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))

+     assert ensure_str(ent.getValue(ALLOCATED_ATTR)) == str(20)

+     topology_st.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ensure_str(ent.getValue(ALLOCATED_ATTR))))

      topology_st.standalone.delete_s(ACTIVE_USER1_DN)

  

  
@@ -455,8 +455,8 @@ 

                                   ALLOCATED_ATTR: str(-1)})))

      ent = topology_st.standalone.getEntry(STAGED_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")

      assert ent.hasAttr(ALLOCATED_ATTR)

-     assert ent.getValue(ALLOCATED_ATTR) == str(-1)

-     topology_st.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))

+     assert ensure_str(ent.getValue(ALLOCATED_ATTR)) == str(-1)

+     topology_st.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ensure_str(ent.getValue(ALLOCATED_ATTR))))

      topology_st.standalone.delete_s(STAGED_USER1_DN)

  

  
@@ -474,8 +474,8 @@ 

                                   ALLOCATED_ATTR: str(20)})))

      ent = topology_st.standalone.getEntry(STAGED_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")

      assert ent.hasAttr(ALLOCATED_ATTR)

-     assert ent.getValue(ALLOCATED_ATTR) == str(20)

-     topology_st.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))

+     assert ensure_str(ent.getValue(ALLOCATED_ATTR)) == str(20)

+     topology_st.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ensure_str(ent.getValue(ALLOCATED_ATTR))))

      topology_st.standalone.delete_s(STAGED_USER1_DN)

  

  
@@ -493,8 +493,8 @@ 

                                  ALLOCATED_ATTR: str(-1)})))

      ent = topology_st.standalone.getEntry(DUMMY_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")

      assert ent.hasAttr(ALLOCATED_ATTR)

-     assert ent.getValue(ALLOCATED_ATTR) != str(-1)

-     topology_st.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))

+     assert ensure_str(ent.getValue(ALLOCATED_ATTR)) != str(-1)

+     topology_st.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ensure_str(ent.getValue(ALLOCATED_ATTR))))

      topology_st.standalone.delete_s(DUMMY_USER1_DN)

  

  
@@ -512,8 +512,8 @@ 

                                  ALLOCATED_ATTR: str(20)})))

      ent = topology_st.standalone.getEntry(DUMMY_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")

      assert ent.hasAttr(ALLOCATED_ATTR)

-     assert ent.getValue(ALLOCATED_ATTR) == str(20)

-     topology_st.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))

+     assert ensure_str(ent.getValue(ALLOCATED_ATTR)) == str(20)

+     topology_st.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ensure_str(ent.getValue(ALLOCATED_ATTR))))

      topology_st.standalone.delete_s(DUMMY_USER1_DN)

  

  
@@ -526,7 +526,7 @@ 

      dn_config = "cn=excluded scope, cn=%s, %s" % (PLUGIN_DNA, DN_PLUGIN)

  

      try:

-         mod = [(ldap.MOD_REPLACE, 'dnaExcludeScope', "invalidDN,%s" % SUFFIX)]

+         mod = [(ldap.MOD_REPLACE, 'dnaExcludeScope', ensure_bytes("invalidDN,%s" % SUFFIX))]

          topology_st.standalone.modify_s(dn_config, mod)

          raise ValueError("invalid dnaExcludeScope value (not a DN)")

      except ldap.INVALID_SYNTAX:
@@ -546,8 +546,8 @@ 

                                   ALLOCATED_ATTR: str(-1)})))

      ent = topology_st.standalone.getEntry(ACTIVE_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")

      assert ent.hasAttr(ALLOCATED_ATTR)

-     assert ent.getValue(ALLOCATED_ATTR) != str(-1)

-     topology_st.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))

+     assert ensure_str(ent.getValue(ALLOCATED_ATTR)) != str(-1)

+     topology_st.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ensure_str(ent.getValue(ALLOCATED_ATTR))))

      topology_st.standalone.delete_s(ACTIVE_USER1_DN)

  

  
@@ -565,8 +565,8 @@ 

                                   ALLOCATED_ATTR: str(20)})))

      ent = topology_st.standalone.getEntry(ACTIVE_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")

      assert ent.hasAttr(ALLOCATED_ATTR)

-     assert ent.getValue(ALLOCATED_ATTR) == str(20)

-     topology_st.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))

+     assert ensure_str(ent.getValue(ALLOCATED_ATTR)) == str(20)

+     topology_st.standalone.log.debug('%s.%s=%s' % (ACTIVE_USER1_CN, ALLOCATED_ATTR, ensure_str(ent.getValue(ALLOCATED_ATTR))))

      topology_st.standalone.delete_s(ACTIVE_USER1_DN)

  

  
@@ -583,8 +583,8 @@ 

                                   ALLOCATED_ATTR: str(-1)})))

      ent = topology_st.standalone.getEntry(STAGED_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")

      assert ent.hasAttr(ALLOCATED_ATTR)

-     assert ent.getValue(ALLOCATED_ATTR) == str(-1)

-     topology_st.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))

+     assert ensure_str(ent.getValue(ALLOCATED_ATTR)) == str(-1)

+     topology_st.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ensure_str(ent.getValue(ALLOCATED_ATTR))))

      topology_st.standalone.delete_s(STAGED_USER1_DN)

  

  
@@ -602,8 +602,8 @@ 

                                   ALLOCATED_ATTR: str(20)})))

      ent = topology_st.standalone.getEntry(STAGED_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")

      assert ent.hasAttr(ALLOCATED_ATTR)

-     assert ent.getValue(ALLOCATED_ATTR) == str(20)

-     topology_st.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))

+     assert ensure_str(ent.getValue(ALLOCATED_ATTR)) == str(20)

+     topology_st.standalone.log.debug('%s.%s=%s' % (STAGED_USER1_CN, ALLOCATED_ATTR, ensure_str(ent.getValue(ALLOCATED_ATTR))))

      topology_st.standalone.delete_s(STAGED_USER1_DN)

  

  
@@ -620,8 +620,8 @@ 

                                  ALLOCATED_ATTR: str(-1)})))

      ent = topology_st.standalone.getEntry(DUMMY_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")

      assert ent.hasAttr(ALLOCATED_ATTR)

-     assert ent.getValue(ALLOCATED_ATTR) != str(-1)

-     topology_st.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))

+     assert ensure_str(ent.getValue(ALLOCATED_ATTR)) != str(-1)

+     topology_st.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ensure_str(ent.getValue(ALLOCATED_ATTR))))

      topology_st.standalone.delete_s(DUMMY_USER1_DN)

  

  
@@ -639,8 +639,8 @@ 

                                  ALLOCATED_ATTR: str(20)})))

      ent = topology_st.standalone.getEntry(DUMMY_USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)")

      assert ent.hasAttr(ALLOCATED_ATTR)

-     assert ent.getValue(ALLOCATED_ATTR) == str(20)

-     topology_st.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ent.getValue(ALLOCATED_ATTR)))

+     assert ensure_str(ent.getValue(ALLOCATED_ATTR)) == str(20)

+     topology_st.standalone.log.debug('%s.%s=%s' % (DUMMY_USER1_CN, ALLOCATED_ATTR, ensure_str(ent.getValue(ALLOCATED_ATTR))))

      topology_st.standalone.delete_s(DUMMY_USER1_DN)

  

  

@@ -93,7 +93,7 @@ 

  

          for val in ent.getValues('memberof'):

              topology_st.standalone.log.info("!!!!!!! %s: memberof->%s" % (user_dn, val))

-             if val == group_dn:

+             if ensure_str(val) == group_dn:

                  found = True

                  break

  
@@ -113,7 +113,7 @@ 

  

          for val in ent.getValues('member'):

              topology_st.standalone.log.info("!!!!!!! %s: member ->%s" % (group_dn, val))

-             if val == user_dn:

+             if ensure_str(val) == user_dn:

                  found = True

                  break

  
@@ -171,7 +171,7 @@ 

      topology_st.standalone.log.info('\n%s entry %s' % (txt, user_dn))

      topology_st.standalone.log.info('to group %s' % group_dn)

  

-     topology_st.standalone.modify_s(group_dn, [(action, 'member', user_dn)])

+     topology_st.standalone.modify_s(group_dn, [(action, 'member', ensure_bytes(user_dn))])

      time.sleep(1)

      _find_memberof(topology_st, user_dn=user_dn, group_dn=group_dn, find_result=find_result)

  
@@ -218,15 +218,15 @@ 

      # enable memberof of with scope IN except provisioning

      topology_st.standalone.plugins.enable(name=PLUGIN_MEMBER_OF)

      dn = "cn=%s,%s" % (PLUGIN_MEMBER_OF, DN_PLUGIN)

-     topology_st.standalone.modify_s(dn, [(ldap.MOD_REPLACE, 'memberOfEntryScope', SCOPE_IN_DN)])

-     topology_st.standalone.modify_s(dn, [(ldap.MOD_REPLACE, 'memberOfEntryScopeExcludeSubtree', PROVISIONING_DN)])

+     topology_st.standalone.modify_s(dn, [(ldap.MOD_REPLACE, 'memberOfEntryScope', ensure_bytes(SCOPE_IN_DN))])

+     topology_st.standalone.modify_s(dn, [(ldap.MOD_REPLACE, 'memberOfEntryScopeExcludeSubtree', ensure_bytes(PROVISIONING_DN))])

  

      # enable RI with scope IN except provisioning

      topology_st.standalone.plugins.enable(name=PLUGIN_REFER_INTEGRITY)

      dn = "cn=%s,%s" % (PLUGIN_REFER_INTEGRITY, DN_PLUGIN)

-     topology_st.standalone.modify_s(dn, [(ldap.MOD_REPLACE, 'nsslapd-pluginentryscope', SCOPE_IN_DN)])

-     topology_st.standalone.modify_s(dn, [(ldap.MOD_REPLACE, 'nsslapd-plugincontainerscope', SCOPE_IN_DN)])

-     topology_st.standalone.modify_s(dn, [(ldap.MOD_REPLACE, 'nsslapd-pluginExcludeEntryScope', PROVISIONING_DN)])

+     topology_st.standalone.modify_s(dn, [(ldap.MOD_REPLACE, 'nsslapd-pluginentryscope', ensure_bytes(SCOPE_IN_DN))])

+     topology_st.standalone.modify_s(dn, [(ldap.MOD_REPLACE, 'nsslapd-plugincontainerscope', ensure_bytes(SCOPE_IN_DN))])

+     topology_st.standalone.modify_s(dn, [(ldap.MOD_REPLACE, 'nsslapd-pluginExcludeEntryScope', ensure_bytes(PROVISIONING_DN))])

  

      topology_st.standalone.restart(timeout=10)

  
@@ -494,7 +494,7 @@ 

  def test_ticket47829_indirect_active_group_1(topology_st):

      _header(topology_st, 'add an Active group (G1) to an active group (G0). Then add active user to G1')

  

-     topology_st.standalone.modify_s(INDIRECT_ACTIVE_GROUP_DN, [(ldap.MOD_ADD, 'member', ACTIVE_GROUP_DN)])

+     topology_st.standalone.modify_s(INDIRECT_ACTIVE_GROUP_DN, [(ldap.MOD_ADD, 'member', ensure_bytes(ACTIVE_GROUP_DN))])

  

      # add an active user to G1. Checks that user is memberof G1

      _check_memberof(topology_st, action=ldap.MOD_ADD, user_dn=ACTIVE_USER_DN, group_dn=ACTIVE_GROUP_DN,
@@ -502,7 +502,7 @@ 

      _find_memberof(topology_st, user_dn=ACTIVE_USER_DN, group_dn=INDIRECT_ACTIVE_GROUP_DN, find_result=True)

  

      # remove G1 from G0

-     topology_st.standalone.modify_s(INDIRECT_ACTIVE_GROUP_DN, [(ldap.MOD_DELETE, 'member', ACTIVE_GROUP_DN)])

+     topology_st.standalone.modify_s(INDIRECT_ACTIVE_GROUP_DN, [(ldap.MOD_DELETE, 'member', ensure_bytes(ACTIVE_GROUP_DN))])

      _find_memberof(topology_st, user_dn=ACTIVE_USER_DN, group_dn=INDIRECT_ACTIVE_GROUP_DN, find_result=False)

      _find_memberof(topology_st, user_dn=ACTIVE_USER_DN, group_dn=ACTIVE_GROUP_DN, find_result=True)

  
@@ -515,7 +515,7 @@ 

      _header(topology_st,

              'add an Active group (G1) to an active group (G0). Then add active user to G1. Then move active user to stage')

  

-     topology_st.standalone.modify_s(INDIRECT_ACTIVE_GROUP_DN, [(ldap.MOD_ADD, 'member', ACTIVE_GROUP_DN)])

+     topology_st.standalone.modify_s(INDIRECT_ACTIVE_GROUP_DN, [(ldap.MOD_ADD, 'member', ensure_bytes(ACTIVE_GROUP_DN))])

  

      # add an active user to G1. Checks that user is memberof G1

      _check_memberof(topology_st, action=ldap.MOD_ADD, user_dn=ACTIVE_USER_DN, group_dn=ACTIVE_GROUP_DN,
@@ -523,7 +523,7 @@ 

      _find_memberof(topology_st, user_dn=ACTIVE_USER_DN, group_dn=INDIRECT_ACTIVE_GROUP_DN, find_result=True)

  

      # remove G1 from G0

-     topology_st.standalone.modify_s(INDIRECT_ACTIVE_GROUP_DN, [(ldap.MOD_DELETE, 'member', ACTIVE_GROUP_DN)])

+     topology_st.standalone.modify_s(INDIRECT_ACTIVE_GROUP_DN, [(ldap.MOD_DELETE, 'member', ensure_bytes(ACTIVE_GROUP_DN))])

      _find_memberof(topology_st, user_dn=ACTIVE_USER_DN, group_dn=INDIRECT_ACTIVE_GROUP_DN, find_result=False)

      _find_memberof(topology_st, user_dn=ACTIVE_USER_DN, group_dn=ACTIVE_GROUP_DN, find_result=True)

  
@@ -555,7 +555,7 @@ 

      _header(topology_st,

              'add an Active group (G1) to an active group (G0). Then add active user to G1. Then move active user to out of the scope')

  

-     topology_st.standalone.modify_s(INDIRECT_ACTIVE_GROUP_DN, [(ldap.MOD_ADD, 'member', ACTIVE_GROUP_DN)])

+     topology_st.standalone.modify_s(INDIRECT_ACTIVE_GROUP_DN, [(ldap.MOD_ADD, 'member', ensure_bytes(ACTIVE_GROUP_DN))])

  

      # add an active user to G1. Checks that user is memberof G1

      _check_memberof(topology_st, action=ldap.MOD_ADD, user_dn=ACTIVE_USER_DN, group_dn=ACTIVE_GROUP_DN,
@@ -563,7 +563,7 @@ 

      _find_memberof(topology_st, user_dn=ACTIVE_USER_DN, group_dn=INDIRECT_ACTIVE_GROUP_DN, find_result=True)

  

      # remove G1 from G0

-     topology_st.standalone.modify_s(INDIRECT_ACTIVE_GROUP_DN, [(ldap.MOD_DELETE, 'member', ACTIVE_GROUP_DN)])

+     topology_st.standalone.modify_s(INDIRECT_ACTIVE_GROUP_DN, [(ldap.MOD_DELETE, 'member', ensure_bytes(ACTIVE_GROUP_DN))])

      _find_memberof(topology_st, user_dn=ACTIVE_USER_DN, group_dn=INDIRECT_ACTIVE_GROUP_DN, find_result=False)

      _find_memberof(topology_st, user_dn=ACTIVE_USER_DN, group_dn=ACTIVE_GROUP_DN, find_result=True)

  
@@ -595,7 +595,7 @@ 

      _header(topology_st,

              'add an Active group (G1) to an active group (G0). Then add stage user to G1. Then move user to active. Then move it back')

  

-     topology_st.standalone.modify_s(INDIRECT_ACTIVE_GROUP_DN, [(ldap.MOD_ADD, 'member', ACTIVE_GROUP_DN)])

+     topology_st.standalone.modify_s(INDIRECT_ACTIVE_GROUP_DN, [(ldap.MOD_ADD, 'member', ensure_bytes(ACTIVE_GROUP_DN))])

  

      # add stage user to active group

      _check_memberof(topology_st, action=ldap.MOD_ADD, user_dn=STAGE_USER_DN, group_dn=ACTIVE_GROUP_DN,

@@ -109,7 +109,7 @@ 

  

          for val in ent.getValues('member'):

              topology_st.standalone.log.info("!!!!!!! %s: member ->%s" % (group_dn, val))

-             if val == user_dn:

+             if ensure_str(val) == user_dn:

                  found = True

                  break

  
@@ -144,7 +144,7 @@ 

      topology_st.standalone.log.info('\n%s entry %s' % (txt, user_dn))

      topology_st.standalone.log.info('to group %s' % group_dn)

  

-     topology_st.standalone.modify_s(group_dn, [(action, 'member', user_dn)])

+     topology_st.standalone.modify_s(group_dn, [(action, 'member', ensure_bytes(user_dn))])

      time.sleep(1)

      _find_memberof(topology_st, user_dn=user_dn, group_dn=group_dn, find_result=find_result)

  
@@ -188,7 +188,7 @@ 

      # enable memberof of with scope account

      topology_st.standalone.plugins.enable(name=PLUGIN_MEMBER_OF)

      dn = "cn=%s,%s" % (PLUGIN_MEMBER_OF, DN_PLUGIN)

-     topology_st.standalone.modify_s(dn, [(ldap.MOD_REPLACE, 'memberOfEntryScope', ACTIVE_DN)])

+     topology_st.standalone.modify_s(dn, [(ldap.MOD_REPLACE, 'memberOfEntryScope', ensure_bytes(ACTIVE_DN))])

  

      topology_st.standalone.restart(timeout=10)

  

@@ -15,6 +15,7 @@ 

  from lib389 import Entry

  from lib389._constants import *

  from lib389.topologies import topology_st

+ from lib389.nss_ssl import NssSsl

  

  log = logging.getLogger(__name__)

  
@@ -24,7 +25,7 @@ 

  # Skip on older versions

  pytestmark = pytest.mark.skipif(ds_is_older('1.3.3'), reason="Not implemented")

  ENCRYPTION_DN = 'cn=encryption,%s' % CONFIG_DN

- MY_SECURE_PORT = '36363'

+ MY_SECURE_PORT = '63601'

  RSA = 'RSA'

  RSA_DN = 'cn=%s,%s' % (RSA, ENCRYPTION_DN)

  SERVERCERT = 'Server-Cert'
@@ -57,26 +58,25 @@ 

      Enable SSL

      """

      _header(topology_st, 'Testing Ticket 47838 - harden the list of ciphers available by default')

- 

      onss_version = os.popen("rpm -q nss | awk -F'-' '{print $2}'", "r")

      global nss_version

      nss_version = onss_version.readline()

- 

-     topology_st.standalone.nss_ssl.reinit()

-     topology_st.standalone.nss_ssl.create_rsa_ca()

-     topology_st.standalone.nss_ssl.create_rsa_key_and_cert()

+     nss_ssl = NssSsl(dbpath=topology_st.standalone.get_cert_dir())

+     nss_ssl.reinit()

+     nss_ssl.create_rsa_ca()

+     nss_ssl.create_rsa_key_and_cert()

  

      log.info("\n######################### enable SSL in the directory server with all ciphers ######################\n")

      topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)

-     topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3', 'off'),

-                                                     (ldap.MOD_REPLACE, 'nsTLS1', 'on'),

-                                                     (ldap.MOD_REPLACE, 'nsSSLClientAuth', 'allowed'),

-                                                     (ldap.MOD_REPLACE, 'allowWeakCipher', 'on'),

-                                                     (ldap.MOD_REPLACE, 'nsSSL3Ciphers', '+all')])

+     topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3', b'off'),

+                                                     (ldap.MOD_REPLACE, 'nsTLS1', b'on'),

+                                                     (ldap.MOD_REPLACE, 'nsSSLClientAuth', b'allowed'),

+                                                     (ldap.MOD_REPLACE, 'allowWeakCipher', b'on'),

+                                                     (ldap.MOD_REPLACE, 'nsSSL3Ciphers', b'+all')])

  

-     topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE, 'nsslapd-security', 'on'),

-                                                 (ldap.MOD_REPLACE, 'nsslapd-ssl-check-hostname', 'off'),

-                                                 (ldap.MOD_REPLACE, 'nsslapd-secureport', MY_SECURE_PORT)])

+     topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE, 'nsslapd-security', b'on'),

+                                                 (ldap.MOD_REPLACE, 'nsslapd-ssl-check-hostname', b'off'),

+                                                 (ldap.MOD_REPLACE, 'nsslapd-secureport', ensure_bytes(MY_SECURE_PORT))])

  

      topology_st.standalone.add_s(Entry((RSA_DN, {'objectclass': "top nsEncryptionModule".split(),

                                                   'cn': RSA,
@@ -111,9 +111,8 @@ 

      Note: allowWeakCipher: on

      """

      _header(topology_st, 'Test Case 1 - Check the ciphers availability for "+all"; allowWeakCipher: on')

- 

      topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)

-     topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', '64')])

+     topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', b'64')])

      time.sleep(5)

      log.info("\n######################### Restarting the server ######################\n")

      topology_st.standalone.restart(timeout=120)
@@ -152,7 +151,7 @@ 

      _header(topology_st, 'Test Case 2 - Check the ciphers availability for "+all" with default allowWeakCiphers')

  

      topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)

-     topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', '64')])

+     topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', b'64')])

      time.sleep(1)

      # Make sure allowWeakCipher is not set.

      topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_DELETE, 'allowWeakCipher', None)])
@@ -198,7 +197,7 @@ 

  

      topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)

      topology_st.standalone.modify_s(ENCRYPTION_DN,

-                                     [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', '+rsa_aes_128_sha,+rsa_aes_256_sha')])

+                                     [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', b'+rsa_aes_128_sha,+rsa_aes_256_sha')])

  

      log.info("\n######################### Restarting the server ######################\n")

      topology_st.standalone.stop(timeout=10)
@@ -231,7 +230,7 @@ 

      _header(topology_st, 'Test Case 4 - Check the ciphers availability for "-all"')

  

      topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)

-     topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', '-all')])

+     topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', b'-all')])

  

      log.info("\n######################### Restarting the server ######################\n")

      topology_st.standalone.stop(timeout=10)
@@ -263,7 +262,7 @@ 

      _header(topology_st, 'Test Case 5 - Check no nsSSL3Ciphers (default setting) with default allowWeakCipher')

  

      topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)

-     topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_DELETE, 'nsSSL3Ciphers', '-all')])

+     topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_DELETE, 'nsSSL3Ciphers', b'-all')])

  

      log.info("\n######################### Restarting the server ######################\n")

      topology_st.standalone.stop(timeout=10)
@@ -271,7 +270,6 @@ 

      os.system('touch %s' % (topology_st.standalone.errlog))

      time.sleep(1)

      topology_st.standalone.start(timeout=120)

- 

      enabled = os.popen('egrep "SSL info:" %s | egrep \": enabled\" | wc -l' % topology_st.standalone.errlog)

      disabled = os.popen('egrep "SSL info:" %s | egrep \": disabled\" | wc -l' % topology_st.standalone.errlog)

      ecount = int(enabled.readline().rstrip())
@@ -282,7 +280,7 @@ 

      global plus_all_ecount

      global plus_all_dcount

      if nss_version >= NSS330:

-         assert ecount == 26

+         assert ecount == 28

      elif nss_version >= NSS323:

          assert ecount == 29

      else:
@@ -306,7 +304,7 @@ 

      _header(topology_st, 'Test Case 6 - Check default nsSSL3Ciphers (default setting) with default allowWeakCipher')

  

      topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)

-     topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', 'default')])

+     topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', b'default')])

  

      log.info("\n######################### Restarting the server ######################\n")

      topology_st.standalone.stop(timeout=10)
@@ -325,7 +323,7 @@ 

      global plus_all_ecount

      global plus_all_dcount

      if nss_version >= NSS330:

-         assert ecount == 26

+         assert ecount == 28

      elif nss_version >= NSS323:

          assert ecount == 29

      else:
@@ -351,7 +349,7 @@ 

  

      topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)

      topology_st.standalone.modify_s(ENCRYPTION_DN,

-                                     [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', '+all,-tls_dhe_rsa_aes_128_gcm_sha')])

+                                     [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', b'+all,-tls_dhe_rsa_aes_128_gcm_sha')])

  

      log.info("\n######################### Restarting the server ######################\n")

      topology_st.standalone.stop(timeout=10)
@@ -386,7 +384,7 @@ 

      _header(topology_st, 'Test Case 8 - Check nsSSL3Ciphers: -all,+rsa_rc4_128_md5 with default allowWeakCipher')

  

      topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)

-     topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', '-all,+rsa_rc4_128_md5')])

+     topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', b'-all,+rsa_rc4_128_md5')])

  

      log.info("\n######################### Restarting the server ######################\n")

      topology_st.standalone.stop(timeout=10)
@@ -418,8 +416,8 @@ 

      _header(topology_st, 'Test Case 9 - Check default nsSSL3Ciphers (default setting + allowWeakCipher: off)')

  

      topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)

-     topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', 'default'),

-                                                     (ldap.MOD_REPLACE, 'allowWeakCipher', 'off')])

+     topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', b'default'),

+                                                     (ldap.MOD_REPLACE, 'allowWeakCipher', b'off')])

  

      log.info("\n######################### Restarting the server ######################\n")

      topology_st.standalone.stop(timeout=10)
@@ -438,7 +436,7 @@ 

      global plus_all_ecount

      global plus_all_dcount

      if nss_version >= NSS330:

-         assert ecount == 26

+         assert ecount == 28

      elif nss_version >= NSS323:

          assert ecount == 29

      else:
@@ -465,7 +463,7 @@ 

  

      topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)

      topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', None),

-                                                     (ldap.MOD_REPLACE, 'allowWeakCipher', 'on')])

+                                                     (ldap.MOD_REPLACE, 'allowWeakCipher', b'on')])

      topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', None)])

  

      log.info("\n######################### Restarting the server ######################\n")
@@ -483,7 +481,7 @@ 

      log.info("Enabled ciphers: %d" % ecount)

      log.info("Disabled ciphers: %d" % dcount)

      if nss_version >= NSS330:

-         assert ecount == 31

+         assert ecount == 33

      elif nss_version >= NSS327:

          assert ecount == 34

      elif nss_version >= NSS323:
@@ -523,7 +521,7 @@ 

  

      topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)

      topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3Ciphers',

-                                                      '-TLS_RSA_WITH_NULL_MD5,+TLS_RSA_WITH_RC4_128_MD5,+TLS_RSA_EXPORT_WITH_RC4_40_MD5,+TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5,+TLS_DHE_RSA_WITH_DES_CBC_SHA,+SSL_RSA_FIPS_WITH_DES_CBC_SHA,+TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA,+SSL_RSA_FIPS_WITH_3DES_EDE_CBC_SHA,+TLS_RSA_EXPORT1024_WITH_RC4_56_SHA,+TLS_RSA_EXPORT1024_WITH_DES_CBC_SHA,-SSL_CK_RC4_128_WITH_MD5,-SSL_CK_RC4_128_EXPORT40_WITH_MD5,-SSL_CK_RC2_128_CBC_WITH_MD5,-SSL_CK_RC2_128_CBC_EXPORT40_WITH_MD5,-SSL_CK_DES_64_CBC_WITH_MD5,-SSL_CK_DES_192_EDE3_CBC_WITH_MD5')])

+                                                      b'-TLS_RSA_WITH_NULL_MD5,+TLS_RSA_WITH_RC4_128_MD5,+TLS_RSA_EXPORT_WITH_RC4_40_MD5,+TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5,+TLS_DHE_RSA_WITH_DES_CBC_SHA,+SSL_RSA_FIPS_WITH_DES_CBC_SHA,+TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA,+SSL_RSA_FIPS_WITH_3DES_EDE_CBC_SHA,+TLS_RSA_EXPORT1024_WITH_RC4_56_SHA,+TLS_RSA_EXPORT1024_WITH_DES_CBC_SHA,-SSL_CK_RC4_128_WITH_MD5,-SSL_CK_RC4_128_EXPORT40_WITH_MD5,-SSL_CK_RC2_128_CBC_WITH_MD5,-SSL_CK_RC2_128_CBC_EXPORT40_WITH_MD5,-SSL_CK_DES_64_CBC_WITH_MD5,-SSL_CK_DES_192_EDE3_CBC_WITH_MD5')])

  

      log.info("\n######################### Restarting the server ######################\n")

      topology_st.standalone.stop(timeout=10)
@@ -564,7 +562,7 @@ 

      _header(topology_st, 'Test Case 12 - Check nsSSL3Ciphers: +fortezza, which is not supported')

  

      topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)

-     topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', '+fortezza')])

+     topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', b'+fortezza')])

  

      log.info("\n######################### Restarting the server ######################\n")

      topology_st.standalone.stop(timeout=10)
@@ -593,15 +591,15 @@ 

  

      topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)

      # add them once and remove them

-     topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3', 'off'),

-                                                     (ldap.MOD_REPLACE, 'nsTLS1', 'on'),

-                                                     (ldap.MOD_REPLACE, 'sslVersionMin', 'TLS1.1'),

-                                                     (ldap.MOD_REPLACE, 'sslVersionMax', 'TLS1.2')])

+     topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3', b'off'),

+                                                     (ldap.MOD_REPLACE, 'nsTLS1', b'on'),

+                                                     (ldap.MOD_REPLACE, 'sslVersionMin', b'TLS1.1'),

+                                                     (ldap.MOD_REPLACE, 'sslVersionMax', b'TLS1.2')])

      topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_DELETE, 'nsSSL3', None),

                                                      (ldap.MOD_DELETE, 'nsTLS1', None),

                                                      (ldap.MOD_DELETE, 'sslVersionMin', None),

                                                      (ldap.MOD_DELETE, 'sslVersionMax', None)])

-     topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', '64')])

+     topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', b'64')])

      time.sleep(5)

  

      log.info("\n######################### Restarting the server ######################\n")
@@ -629,8 +627,8 @@ 

      _header(topology_st, 'Test Case 14 - No nsSSL3, nsTLS1; sslVersionMin > sslVersionMax')

  

      topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)

-     topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'sslVersionMin', 'TLS1.2'),

-                                                     (ldap.MOD_REPLACE, 'sslVersionMax', 'TLS1.1')])

+     topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'sslVersionMin', b'TLS1.2'),

+                                                     (ldap.MOD_REPLACE, 'sslVersionMax', b'TLS1.1')])

  

      log.info("\n######################### Restarting the server ######################\n")

      topology_st.standalone.stop(timeout=10)
@@ -665,9 +663,9 @@ 

      _header(topology_st, 'Test Case 15 - nsSSL3: on; sslVersionMin: TLS1.1; sslVersionMax: TLS1.2')

  

      topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)

-     topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'sslVersionMin', 'TLS1.1'),

-                                                     (ldap.MOD_REPLACE, 'sslVersionMax', 'TLS1.2'),

-                                                     (ldap.MOD_REPLACE, 'nsSSL3', 'on')])

+     topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'sslVersionMin', b'TLS1.1'),

+                                                     (ldap.MOD_REPLACE, 'sslVersionMax', b'TLS1.2'),

+                                                     (ldap.MOD_REPLACE, 'nsSSL3', b'on')])

  

      log.info("\n######################### Restarting the server ######################\n")

      topology_st.standalone.stop(timeout=10)
@@ -711,10 +709,10 @@ 

      _header(topology_st, 'Test Case 16 - nsSSL3: on; nsTLS1: off; sslVersionMin: TLS1.1; sslVersionMax: TLS1.2')

  

      topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)

-     topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'sslVersionMin', 'TLS1.1'),

-                                                     (ldap.MOD_REPLACE, 'sslVersionMax', 'TLS1.2'),

-                                                     (ldap.MOD_REPLACE, 'nsSSL3', 'on'),

-                                                     (ldap.MOD_REPLACE, 'nsTLS1', 'off')])

+     topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'sslVersionMin', b'TLS1.1'),

+                                                     (ldap.MOD_REPLACE, 'sslVersionMax', b'TLS1.2'),

+                                                     (ldap.MOD_REPLACE, 'nsSSL3', b'on'),

+                                                     (ldap.MOD_REPLACE, 'nsTLS1', b'off')])

  

      log.info("\n######################### Restarting the server ######################\n")

      topology_st.standalone.stop(timeout=10)
@@ -759,7 +757,7 @@ 

  

      topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)

      topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', None)])

-     topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', 'all')])

+     topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', b'all')])

  

      log.info("\n######################### Restarting the server ######################\n")

      topology_st.standalone.stop(timeout=10)

@@ -14,6 +14,8 @@ 

  from lib389 import Entry

  from lib389._constants import *

  from lib389.topologies import topology_m2

+ from lib389.replica import ReplicationManager

+ from lib389.utils import *

  

  logging.getLogger(__name__).setLevel(logging.DEBUG)

  log = logging.getLogger(__name__)
@@ -26,6 +28,11 @@ 

  BIND_DN = 'cn=%s, %s' % (BIND_NAME, SUFFIX)

  BIND_PW = 'password'

  

+ def replication_check(topology_m2):

+     repl = ReplicationManager(SUFFIX)

+     master1 = topology_m2.ms["master1"]

+     master2 = topology_m2.ms["master2"]

+     return repl.test_replication(master1, master2)

  

  def test_ticket47869_init(topology_m2):

      """
@@ -34,7 +41,7 @@ 

  

      """

      # enable acl error logging

-     mod = [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', str(8192))]  # REPL

+     mod = [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', ensure_bytes(str(8192)))]  # REPL

      topology_m2.ms["master1"].modify_s(DN_CONFIG, mod)

      topology_m2.ms["master2"].modify_s(DN_CONFIG, mod)

  
@@ -45,21 +52,12 @@ 

          'sn': BIND_NAME,

          'cn': BIND_NAME,

          'userpassword': BIND_PW})))

-     loop = 0

-     ent = None

-     while loop <= 10:

-         try:

-             ent = topology_m2.ms["master2"].getEntry(BIND_DN, ldap.SCOPE_BASE, "(objectclass=*)")

-             break

-         except ldap.NO_SUCH_OBJECT:

-             time.sleep(1)

-             loop += 1

-     if ent is None:

-         assert False

- 

+     replication_check(topology_m2)

+     ent = topology_m2.ms["master2"].getEntry(BIND_DN, ldap.SCOPE_BASE, "(objectclass=*)")

+     assert ent

      # keep anonymous ACI for use 'read-search' aci in SEARCH test

      ACI_ANONYMOUS = "(targetattr!=\"userPassword\")(version 3.0; acl \"Enable anonymous access\"; allow (read, search, compare) userdn=\"ldap:///anyone\";)"

-     mod = [(ldap.MOD_REPLACE, 'aci', ACI_ANONYMOUS)]

+     mod = [(ldap.MOD_REPLACE, 'aci', ensure_bytes(ACI_ANONYMOUS))]

      topology_m2.ms["master1"].modify_s(SUFFIX, mod)

      topology_m2.ms["master2"].modify_s(SUFFIX, mod)

  
@@ -71,18 +69,9 @@ 

                                                 {'objectclass': "top person".split(),

                                                  'sn': name,

                                                  'cn': name})))

-         loop = 0

-         ent = None

-         while loop <= 10:

-             try:

-                 ent = topology_m2.ms["master2"].getEntry(mydn, ldap.SCOPE_BASE, "(objectclass=*)")

-                 break

-             except ldap.NO_SUCH_OBJECT:

-                 time.sleep(1)

-                 loop += 1

-         if ent is None:

-             assert False

- 

+         replication_check(topology_m2)

+         ent = topology_m2.ms["master2"].getEntry(mydn, ldap.SCOPE_BASE, "(objectclass=*)")

+         assert ent

  

  def test_ticket47869_check(topology_m2):

      '''

@@ -41,8 +41,8 @@ 

          Initialize the test environment

      """

      topology_m1c1.ms["master1"].plugins.enable(name=PLUGIN_RETRO_CHANGELOG)

-     mod = [(ldap.MOD_REPLACE, 'nsslapd-changelogmaxage', "10s"),  # 10 second triming

-            (ldap.MOD_REPLACE, 'nsslapd-changelog-trim-interval', "5s")]

+     mod = [(ldap.MOD_REPLACE, 'nsslapd-changelogmaxage', b"10s"),  # 10 second triming

+            (ldap.MOD_REPLACE, 'nsslapd-changelog-trim-interval', b"5s")]

      topology_m1c1.ms["master1"].modify_s("cn=%s,%s" % (PLUGIN_RETRO_CHANGELOG, DN_PLUGIN), mod)

      # topology_m1c1.ms["master1"].plugins.enable(name=PLUGIN_MEMBER_OF)

      # topology_m1c1.ms["master1"].plugins.enable(name=PLUGIN_REFER_INTEGRITY)

@@ -13,6 +13,7 @@ 

  from lib389 import Entry

  from lib389._constants import *

  from lib389.topologies import topology_st

+ from lib389.utils import *

  

  log = logging.getLogger(__name__)

  
@@ -50,24 +51,20 @@ 

      try:

          topology_st.standalone.add_s(entry)

      except ldap.LDAPError as e:

-         topology_st.standalone.log.error('Unexpected result ' + e.message['desc'])

+         topology_st.standalone.log.error('Unexpected result ' + e.args[0]['desc'])

          assert False

          topology_st.standalone.log.error("Failed to add Password Administator %s, error: %s "

-                                          % (ADMIN_DN, e.message['desc']))

+                                          % (ADMIN_DN, e.args[0]['desc']))

          assert False

  

      topology_st.standalone.log.info("Configuring password policy...")

-     try:

-         topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE, 'nsslapd-pwpolicy-local', 'on'),

-                                                     (ldap.MOD_REPLACE, 'passwordCheckSyntax', 'on'),

-                                                     (ldap.MOD_REPLACE, 'passwordMinCategories', '1'),

-                                                     (ldap.MOD_REPLACE, 'passwordMinTokenLength', '1'),

-                                                     (ldap.MOD_REPLACE, 'passwordExp', 'on'),

-                                                     (ldap.MOD_REPLACE, 'passwordMinDigits', '1'),

-                                                     (ldap.MOD_REPLACE, 'passwordMinSpecials', '1')])

-     except ldap.LDAPError as e:

-         topology_st.standalone.log.error('Failed configure password policy: ' + e.message['desc'])

-         assert False

+     topology_st.standalone.config.replace_many(('nsslapd-pwpolicy-local', 'on'),

+                                                ('passwordCheckSyntax', 'on'),

+                                                ('passwordMinCategories', '1'),

+                                                ('passwordMinTokenLength', '1'),

+                                                ('passwordExp', 'on'),

+                                                ('passwordMinDigits', '1'),

+                                                ('passwordMinSpecials', '1'))

  

      #

      # Add an aci to allow everyone all access (just makes things easier)
@@ -79,22 +76,14 @@ 

      ACI_ALLOW = "(version 3.0; acl \"Password Admin Access\"; allow (all) "

      ACI_SUBJECT = "(userdn = \"ldap:///anyone\");)"

      ACI_BODY = ACI_TARGET + ACI_TARGETATTR + ACI_ALLOW + ACI_SUBJECT

-     mod = [(ldap.MOD_ADD, 'aci', ACI_BODY)]

-     try:

-         topology_st.standalone.modify_s(SUFFIX, mod)

-     except ldap.LDAPError as e:

-         topology_st.standalone.log.error('Failed to add aci for password admin: ' + e.message['desc'])

-         assert False

+     mod = [(ldap.MOD_ADD, 'aci', ensure_bytes(ACI_BODY))]

+     topology_st.standalone.modify_s(SUFFIX, mod)

  

      #

      # Bind as the Password Admin

      #

      topology_st.standalone.log.info("Bind as the Password Administator (before activating)...")

-     try:

-         topology_st.standalone.simple_bind_s(ADMIN_DN, ADMIN_PWD)

-     except ldap.LDAPError as e:

-         topology_st.standalone.log.error('Failed to bind as the Password Admin: ' + e.message['desc'])

-         assert False

+     topology_st.standalone.simple_bind_s(ADMIN_DN, ADMIN_PWD)

  

      #

      # Setup our test entry, and test password policy is working
@@ -118,7 +107,7 @@ 

              # We failed as expected

              failed_as_expected = True

              topology_st.standalone.log.info('Add failed as expected: password (%s) result (%s)'

-                                             % (passwd, e.message['desc']))

+                                             % (passwd, e.args[0]['desc']))

  

          if not failed_as_expected:

              topology_st.standalone.log.error("We were incorrectly able to add an entry " +
@@ -132,25 +121,13 @@ 

      topology_st.standalone.log.info("Activate the Password Administator...")

  

      # Bind as Root DN

-     try:

-         topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)

-     except ldap.LDAPError as e:

-         topology_st.standalone.log.error('Root DN failed to authenticate: ' + e.message['desc'])

-         assert False

+     topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)

  

      # Update config

-     try:

-         topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE, 'passwordAdminDN', ADMIN_DN)])

-     except ldap.LDAPError as e:

-         topology_st.standalone.log.error('Failed to add password admin to config: ' + e.message['desc'])

-         assert False

+     topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE, 'passwordAdminDN', ensure_bytes(ADMIN_DN))])

  

      # Bind as Password Admin

-     try:

-         topology_st.standalone.simple_bind_s(ADMIN_DN, ADMIN_PWD)

-     except ldap.LDAPError as e:

-         topology_st.standalone.log.error('Failed to bind as the Password Admin: ' + e.message['desc'])

-         assert False

+     topology_st.standalone.simple_bind_s(ADMIN_DN, ADMIN_PWD)

  

      #

      # Start adding entries with invalid passwords, delete the entry after each pass.
@@ -158,32 +135,17 @@ 

      for passwd in INVALID_PWDS:

          entry.setValues('userpassword', passwd)

          topology_st.standalone.log.info("Create a regular user entry %s with password (%s)..." % (ENTRY_DN, passwd))

-         try:

-             topology_st.standalone.add_s(entry)

-         except ldap.LDAPError as e:

-             topology_st.standalone.log.error('Failed to add entry with password (%s) result (%s)'

-                                              % (passwd, e.message['desc']))

-             assert False

+         topology_st.standalone.add_s(entry)

  

          topology_st.standalone.log.info('Succesfully added entry (%s)' % ENTRY_DN)

  

          # Delete entry for the next pass

-         try:

-             topology_st.standalone.delete_s(ENTRY_DN)

-         except ldap.LDAPError as e:

-             topology_st.standalone.log.error('Failed to delete entry: %s' % (e.message['desc']))

-             assert False

- 

+         topology_st.standalone.delete_s(ENTRY_DN)

      #

      # Add the entry for the next round of testing (modify password)

      #

      entry.setValues('userpassword', ADMIN_PWD)

-     try:

-         topology_st.standalone.add_s(entry)

-     except ldap.LDAPError as e:

-         topology_st.standalone.log.error('Failed to add entry with valid password (%s) result (%s)'

-                                          % (passwd, e.message['desc']))

-         assert False

+     topology_st.standalone.add_s(entry)

  

      #

      # Deactivate the password admin and make sure invalid password updates fail
@@ -191,25 +153,13 @@ 

      topology_st.standalone.log.info("Deactivate Password Administator and try invalid password updates...")

  

      # Bind as root DN

-     try:

-         topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)

-     except ldap.LDAPError as e:

-         topology_st.standalone.log.error('Root DN failed to authenticate: ' + e.message['desc'])

-         assert False

+     topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)

  

-     # Update config

-     try:

-         topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_DELETE, 'passwordAdminDN', None)])

-     except ldap.LDAPError as e:

-         topology_st.standalone.log.error('Failed to remove password admin from config: ' + e.message['desc'])

-         assert False

+     # Update conf

+     topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_DELETE, 'passwordAdminDN', None)])

  

      # Bind as Password Admin

-     try:

-         topology_st.standalone.simple_bind_s(ADMIN_DN, ADMIN_PWD)

-     except ldap.LDAPError as e:

-         topology_st.standalone.log.error('Failed to bind as the Password Admin: ' + e.message['desc'])

-         assert False

+     topology_st.standalone.simple_bind_s(ADMIN_DN, ADMIN_PWD)

  

      #

      # Make invalid password updates that should fail
@@ -218,12 +168,12 @@ 

          failed_as_expected = False

          entry.setValues('userpassword', passwd)

          try:

-             topology_st.standalone.modify_s(ENTRY_DN, [(ldap.MOD_REPLACE, 'userpassword', passwd)])

+             topology_st.standalone.modify_s(ENTRY_DN, [(ldap.MOD_REPLACE, 'userpassword', ensure_bytes(passwd))])

          except ldap.LDAPError as e:

              # We failed as expected

              failed_as_expected = True

              topology_st.standalone.log.info('Password update failed as expected: password (%s) result (%s)'

-                                             % (passwd, e.message['desc']))

+                                             % (passwd, e.args[0]['desc']))

  

          if not failed_as_expected:

              topology_st.standalone.log.error("We were incorrectly able to add an invalid password (%s)"
@@ -235,38 +185,21 @@ 

      #

      topology_st.standalone.log.info("Activate Password Administator and try updates again...")

  

-     # Bind as root DN

-     try:

-         topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)

-     except ldap.LDAPError as e:

-         topology_st.standalone.log.error('Root DN failed to authenticate: ' + e.message['desc'])

-         assert False

+     # Bind as root D

+     topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)

  

      # Update config

-     try:

-         topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE, 'passwordAdminDN', ADMIN_DN)])

-     except ldap.LDAPError as e:

-         topology_st.standalone.log.error('Failed to add password admin to config: ' + e.message['desc'])

-         assert False

+     topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE, 'passwordAdminDN', ensure_bytes(ADMIN_DN))])

  

      # Bind as Password Admin

-     try:

-         topology_st.standalone.simple_bind_s(ADMIN_DN, ADMIN_PWD)

-     except ldap.LDAPError as e:

-         topology_st.standalone.log.error('Failed to bind as the Password Admin: ' + e.message['desc'])

-         assert False

+     topology_st.standalone.simple_bind_s(ADMIN_DN, ADMIN_PWD)

  

      #

      # Make the same password updates, but this time they should succeed

      #

      for passwd in INVALID_PWDS:

          entry.setValues('userpassword', passwd)

-         try:

-             topology_st.standalone.modify_s(ENTRY_DN, [(ldap.MOD_REPLACE, 'userpassword', passwd)])

-         except ldap.LDAPError as e:

-             topology_st.standalone.log.error('Password update failed unexpectedly: password (%s) result (%s)'

-                                              % (passwd, e.message['desc']))

-             assert False

+         topology_st.standalone.modify_s(ENTRY_DN, [(ldap.MOD_REPLACE, 'userpassword', ensure_bytes(passwd))])

          topology_st.standalone.log.info('Password update succeeded (%s)' % passwd)

  

  

@@ -22,6 +22,8 @@ 

  

  # Skip on older versions

  pytestmark = pytest.mark.skipif(ds_is_older('1.3.4'), reason="Not implemented")

+ 

+ 

  @pytest.fixture(scope="module")

  def log_dir(topology_st):

      '''
@@ -60,8 +62,8 @@ 

      log.info(" ".join(cmd))

      proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

      stdout, stderr = proc.communicate()

-     log.info("standard output" + stdout)

-     log.info("standard errors" + stderr)

+     log.info("standard output" + ensure_str(stdout))

+     log.info("standard errors" + ensure_str(stderr))

      return proc.returncode

  

  
@@ -151,8 +153,8 @@ 

      log.info(" ".join(cmd))

      proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

      stdout, stderr = proc.communicate()

-     log.info("standard output" + stdout)

-     log.info("standard errors" + stderr)

+     log.info("standard output" + ensure_str(stdout))

+     log.info("standard errors" + ensure_str(stderr))

  

      assert proc.returncode == 1

  

@@ -105,11 +105,11 @@ 

      topology_st.standalone.log.info("Check the initial value of the entry")

      ent = topology_st.standalone.getEntry(ACTIVE_USER_DN, ldap.SCOPE_BASE, "(objectclass=*)", ['description'])

      assert ent.hasAttr('description')

-     assert ent.getValue('description') == INITIAL_DESC

+     assert ensure_str(ent.getValue('description')) == INITIAL_DESC

  

      pr = PostReadControl(criticality=True, attrList=['cn', 'description'])

      _, _, _, resp_ctrls = topology_st.standalone.modify_ext_s(ACTIVE_USER_DN,

-                                                               [(ldap.MOD_REPLACE, 'description', [FINAL_DESC])],

+                                                               [(ldap.MOD_REPLACE, 'description', [ensure_bytes(FINAL_DESC)])],

                                                                serverctrls=[pr])

  

      assert resp_ctrls[0].dn == ACTIVE_USER_DN
@@ -119,7 +119,7 @@ 

  

      ent = topology_st.standalone.getEntry(ACTIVE_USER_DN, ldap.SCOPE_BASE, "(objectclass=*)", ['description'])

      assert ent.hasAttr('description')

-     assert ent.getValue('description') == FINAL_DESC

+     assert ensure_str(ent.getValue('description')) == FINAL_DESC

  

  

  if __name__ == '__main__':

@@ -25,79 +25,55 @@ 

      USER_DN = 'uid=user,ou=people,' + DEFAULT_SUFFIX

  

      # Add COS definition

-     try:

-         topology_st.standalone.add_s(Entry((INDIRECT_COS_DN,

-                                             {

-                                                 'objectclass': 'top cosSuperDefinition cosIndirectDefinition ldapSubEntry'.split(),

-                                                 'cosIndirectSpecifier': 'manager',

-                                                 'cosAttribute': 'roomnumber'

-                                                 })))

-     except ldap.LDAPError as e:

-         log.fatal('Failed to add cos defintion, error: ' + e.message['desc'])

-         assert False

+     topology_st.standalone.add_s(Entry((INDIRECT_COS_DN,

+                                         {

+                                             'objectclass': 'top cosSuperDefinition cosIndirectDefinition ldapSubEntry'.split(),

+                                             'cosIndirectSpecifier': 'manager',

+                                             'cosAttribute': 'roomnumber'

+                                             })))

  

      # Add manager entry

-     try:

-         topology_st.standalone.add_s(Entry((MANAGER_DN,

-                                             {'objectclass': 'top extensibleObject'.split(),

-                                              'uid': 'my manager',

-                                              'roomnumber': '1'

-                                              })))

-     except ldap.LDAPError as e:

-         log.fatal('Failed to add manager entry, error: ' + e.message['desc'])

-         assert False

+     topology_st.standalone.add_s(Entry((MANAGER_DN,

+                                         {'objectclass': 'top extensibleObject'.split(),

+                                          'uid': 'my manager',

+                                          'roomnumber': '1'

+                                          })))

  

      # Add user entry

-     try:

-         topology_st.standalone.add_s(Entry((USER_DN,

-                                             {'objectclass': 'top person organizationalPerson inetorgperson'.split(),

-                                              'sn': 'last',

-                                              'cn': 'full',

-                                              'givenname': 'mark',

-                                              'uid': 'user',

-                                              'manager': MANAGER_DN

-                                              })))

-     except ldap.LDAPError as e:

-         log.fatal('Failed to add manager entry, error: ' + e.message['desc'])

-         assert False

+     topology_st.standalone.add_s(Entry((USER_DN,

+                                         {'objectclass': 'top person organizationalPerson inetorgperson'.split(),

+                                          'sn': 'last',

+                                          'cn': 'full',

+                                          'givenname': 'mark',

+                                          'uid': 'user',

+                                          'manager': MANAGER_DN

+                                          })))

  

      # Test COS is working

-     try:

-         entry = topology_st.standalone.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE,

-                                                 "uid=user",

-                                                 ['roomnumber'])

-         if entry:

-             if entry[0].getValue('roomnumber') != '1':

-                 log.fatal('COS is not working.')

-                 assert False

-         else:

-             log.fatal('Failed to find user entry')

+     entry = topology_st.standalone.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE,

+                                             "uid=user",

+                                             ['roomnumber'])

+     if entry:

+         if ensure_str(entry[0].getValue('roomnumber')) != '1':

+             log.fatal('COS is not working.')

              assert False

-     except ldap.LDAPError as e:

-         log.error('Failed to search for user entry: ' + e.message['desc'])

+     else:

+         log.fatal('Failed to find user entry')

          assert False

  

      # Modify manager entry

-     try:

-         topology_st.standalone.modify_s(MANAGER_DN, [(ldap.MOD_REPLACE, 'roomnumber', '2')])

-     except ldap.LDAPError as e:

-         log.error('Failed to modify manager entry: ' + e.message['desc'])

-         assert False

+     topology_st.standalone.modify_s(MANAGER_DN, [(ldap.MOD_REPLACE, 'roomnumber', b'2')])

  

      # Confirm COS is returning the new value

-     try:

-         entry = topology_st.standalone.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE,

-                                                 "uid=user",

-                                                 ['roomnumber'])

-         if entry:

-             if entry[0].getValue('roomnumber') != '2':

-                 log.fatal('COS is not working after manager update.')

-                 assert False

-         else:

-             log.fatal('Failed to find user entry')

+     entry = topology_st.standalone.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE,

+                                             "uid=user",

+                                             ['roomnumber'])

+     if entry:

+         if ensure_str(entry[0].getValue('roomnumber')) != '2':

+             log.fatal('COS is not working after manager update.')

              assert False

-     except ldap.LDAPError as e:

-         log.error('Failed to search for user entry: ' + e.message['desc'])

+     else:

+         log.fatal('Failed to find user entry')

          assert False

  

      log.info('Test complete')

@@ -23,6 +23,7 @@ 

  from lib389 import Entry

  from lib389._constants import *

  from lib389.topologies import topology_m2

+ from lib389.utils import *

  

  logging.getLogger(__name__).setLevel(logging.DEBUG)

  log = logging.getLogger(__name__)
@@ -114,11 +115,11 @@ 

      _header(topology_m2, 'test_ticket47988_init')

  

      # enable acl error logging

-     mod = [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', str(8192))]  # REPL

+     mod = [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', ensure_bytes(str(8192)))]  # REPL

      topology_m2.ms["master1"].modify_s(DN_CONFIG, mod)

      topology_m2.ms["master2"].modify_s(DN_CONFIG, mod)

  

-     mod = [(ldap.MOD_REPLACE, 'nsslapd-accesslog-level', str(260))]  # Internal op

+     mod = [(ldap.MOD_REPLACE, 'nsslapd-accesslog-level', ensure_bytes(str(260)))]  # Internal op

      topology_m2.ms["master1"].modify_s(DN_CONFIG, mod)

      topology_m2.ms["master2"].modify_s(DN_CONFIG, mod)

  
@@ -164,7 +165,7 @@ 

      NAME = 'thierry%s' % postfix

      value = '( %s NAME \'%s\' DESC \'Override for Group Attributes\' STRUCTURAL MUST ( cn ) MAY sn X-ORIGIN ( \'IPA v4.1.2\' \'user defined\' ) )' % (

      OID, NAME)

-     mod = [(ldap.MOD_ADD, 'objectclasses', value)]

+     mod = [(ldap.MOD_ADD, 'objectclasses', ensure_bytes(value))]

      server.modify_s('cn=schema', mod)

  

  
@@ -177,13 +178,13 @@ 

      assert (consumer)

      entryDN = "cn=%s0,%s" % (OTHER_NAME, SUFFIX)

      value = str(randint(100, 200))

-     mod = [(ldap.MOD_REPLACE, 'telephonenumber', value)]

+     mod = [(ldap.MOD_REPLACE, 'telephonenumber', ensure_bytes(value))]

      supplier.modify_s(entryDN, mod)

  

      loop = 0

      while loop <= attempts:

          ent = consumer.getEntry(entryDN, ldap.SCOPE_BASE, "(objectclass=*)", ['telephonenumber'])

-         read_val = ent.telephonenumber or "0"

+         read_val = ensure_str(ent.telephonenumber) or "0"

          if read_val == value:

              break

          # the expected value is not yet replicated. try again

@@ -17,6 +17,7 @@ 

                                DN_DM, PASSWORD, PLUGIN_REPL_SYNC, HOST_STANDALONE,

                                PORT_STANDALONE)

  

+ 

  # Skip on older versions

  pytestmark = pytest.mark.skipif(ds_is_older('1.3.4'), reason="Not implemented")

  
@@ -47,9 +48,9 @@ 

  

      # Enable dynamic plugins

      try:

-         topology_st.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE, 'nsslapd-dynamic-plugins', 'on')])

+         topology_st.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE, 'nsslapd-dynamic-plugins', b'on')])

      except ldap.LDAPError as e:

-         ldap.error('Failed to enable dynamic plugin!' + e.message['desc'])

+         log.error('Failed to enable dynamic plugin! {}'.format(e.args[0]['desc']))

          assert False

  

      # Enable retro changelog
@@ -67,7 +68,7 @@ 

      try:

          ldap_connection.simple_bind_s(DN_DM, PASSWORD)

      except ldap.LDAPError as e:

-         print('Login to LDAP server failed: %s' % e.message['desc'])

+         log.error('Login to LDAP server failed: {}'.format(e.args[0]['desc']))

          assert False

  

      # Test invalid cookies
@@ -79,7 +80,7 @@ 

              log.fatal('Invalid cookie accepted!')

              assert False

          except Exception as e:

-             log.info('Invalid cookie correctly rejected: %s' % e.message['info'])

+             log.info('Invalid cookie correctly rejected: {}'.format(e.args[0]['info']))

              pass

  

      # Success

@@ -34,12 +34,12 @@ 

      try:

          # This plugin enable / disable doesn't seem to create the nsslapd-pluginId correctly?

          inst.modify_s('cn=' + PLUGIN_ATTR_UNIQUENESS + ',cn=plugins,cn=config',

-                       [(ldap.MOD_REPLACE, 'uniqueness-attribute-name', 'mail'),

+                       [(ldap.MOD_REPLACE, 'uniqueness-attribute-name', b'mail'),

                         (ldap.MOD_ADD, 'uniqueness-attribute-name',

-                         'mailAlternateAddress'),

+                         b'mailAlternateAddress'),

                         ])

      except ldap.LDAPError as e:

-         log.fatal('test_ticket48026: Failed to configure plugin for "mail": error ' + e.message['desc'])

+         log.fatal('test_ticket48026: Failed to configure plugin for "mail": error {}'.format(e.args[0]['desc']))

          assert False

  

      inst.restart(timeout=30)
@@ -54,7 +54,7 @@ 

                                       'mailAlternateAddress': 'user1@alt.example.com',

                                       'userpassword': 'password'})))

      except ldap.LDAPError as e:

-         log.fatal('test_ticket48026: Failed to add test user' + USER1_DN + ': error ' + e.message['desc'])

+         log.fatal('test_ticket48026: Failed to add test user' + USER1_DN + ': error {}'.format(e.args[0]['desc']))

          assert False

  

      try:

@@ -31,12 +31,12 @@ 

      # add substr setting to UID_INDEX

      try:

          topology_st.standalone.modify_s(UID_INDEX,

-                                         [(ldap.MOD_ADD, 'objectClass', 'extensibleObject'),

-                                          (ldap.MOD_ADD, 'nsIndexType', 'sub'),

-                                          (ldap.MOD_ADD, 'nsSubStrBegin', '2'),

-                                          (ldap.MOD_ADD, 'nsSubStrEnd', '2')])

+                                         [(ldap.MOD_ADD, 'objectClass', b'extensibleObject'),

+                                          (ldap.MOD_ADD, 'nsIndexType', b'sub'),

+                                          (ldap.MOD_ADD, 'nsSubStrBegin', b'2'),

+                                          (ldap.MOD_ADD, 'nsSubStrEnd', b'2')])

      except ldap.LDAPError as e:

-         log.error('Failed to add substr lengths: error ' + e.message['desc'])

+         log.error('Failed to add substr lengths: error {}'.format(e.args[0]['desc']))

          assert False

  

      # restart the server to apply the indexing
@@ -53,7 +53,7 @@ 

              'givenname': 'a',

              'mail': UID})))

      except ldap.LDAPError as e:

-         log.error('Failed to add ' + USER_DN + ': error ' + e.message['desc'])

+         log.error('Failed to add ' + USER_DN + ': error {}'.format(e.args[0]['desc']))

          assert False

  

      entries = topology_st.standalone.search_s(SUFFIX, ldap.SCOPE_SUBTREE, '(uid=a*)')
@@ -100,12 +100,12 @@ 

      # clean up substr setting to UID_INDEX

      try:

          topology_st.standalone.modify_s(UID_INDEX,

-                                         [(ldap.MOD_DELETE, 'objectClass', 'extensibleObject'),

-                                          (ldap.MOD_DELETE, 'nsIndexType', 'sub'),

-                                          (ldap.MOD_DELETE, 'nsSubStrBegin', '2'),

-                                          (ldap.MOD_DELETE, 'nsSubStrEnd', '2')])

+                                         [(ldap.MOD_DELETE, 'objectClass', b'extensibleObject'),

+                                          (ldap.MOD_DELETE, 'nsIndexType', b'sub'),

+                                          (ldap.MOD_DELETE, 'nsSubStrBegin', b'2'),

+                                          (ldap.MOD_DELETE, 'nsSubStrEnd', b'2')])

      except ldap.LDAPError as e:

-         log.error('Failed to delete substr lengths: error ' + e.message['desc'])

+         log.error('Failed to delete substr lengths: error {}'.format(e.args[0]['desc']))

          assert False

  

      '''
@@ -118,11 +118,11 @@ 

      # add substr setting to UID_INDEX

      try:

          topology_st.standalone.modify_s(UID_INDEX,

-                                         [(ldap.MOD_ADD, 'nsIndexType', 'sub'),

-                                          (ldap.MOD_ADD, 'nsMatchingRule', 'nssubstrbegin=2'),

-                                          (ldap.MOD_ADD, 'nsMatchingRule', 'nssubstrend=2')])

+                                         [(ldap.MOD_ADD, 'nsIndexType', b'sub'),

+                                          (ldap.MOD_ADD, 'nsMatchingRule', b'nssubstrbegin=2'),

+                                          (ldap.MOD_ADD, 'nsMatchingRule', b'nssubstrend=2')])

      except ldap.LDAPError as e:

-         log.error('Failed to add substr lengths: error ' + e.message['desc'])

+         log.error('Failed to add substr lengths: error {}'.format(e.args[0]['desc']))

          assert False

  

      # restart the server to apply the indexing
@@ -139,7 +139,7 @@ 

              'givenname': 'b',

              'mail': UID})))

      except ldap.LDAPError as e:

-         log.error('Failed to add ' + USER_DN + ': error ' + e.message['desc'])

+         log.error('Failed to add ' + USER_DN + ': error {}'.format(e.args[0]['desc']))

          assert False

  

      entries = topology_st.standalone.search_s(SUFFIX, ldap.SCOPE_SUBTREE, '(uid=b*)')
@@ -186,11 +186,11 @@ 

      # clean up substr setting to UID_INDEX

      try:

          topology_st.standalone.modify_s(UID_INDEX,

-                                         [(ldap.MOD_DELETE, 'nsIndexType', 'sub'),

-                                          (ldap.MOD_DELETE, 'nsMatchingRule', 'nssubstrbegin=2'),

-                                          (ldap.MOD_DELETE, 'nsMatchingRule', 'nssubstrend=2')])

+                                         [(ldap.MOD_DELETE, 'nsIndexType', b'sub'),

+                                          (ldap.MOD_DELETE, 'nsMatchingRule', b'nssubstrbegin=2'),

+                                          (ldap.MOD_DELETE, 'nsMatchingRule', b'nssubstrend=2')])

      except ldap.LDAPError as e:

-         log.error('Failed to delete substr lengths: error ' + e.message['desc'])

+         log.error('Failed to delete substr lengths: error {}'.format(e.args[0]['desc']))

          assert False

  

      '''
@@ -208,14 +208,14 @@ 

      # add substr setting to UID_INDEX

      try:

          topology_st.standalone.modify_s(UID_INDEX,

-                                         [(ldap.MOD_ADD, 'nsIndexType', 'sub'),

-                                          (ldap.MOD_ADD, 'nsMatchingRule', 'nssubstrbegin=3'),

-                                          (ldap.MOD_ADD, 'nsMatchingRule', 'nssubstrend=3'),

-                                          (ldap.MOD_ADD, 'objectClass', 'extensibleObject'),

-                                          (ldap.MOD_ADD, 'nsSubStrBegin', '2'),

-                                          (ldap.MOD_ADD, 'nsSubStrEnd', '2')])

+                                         [(ldap.MOD_ADD, 'nsIndexType', b'sub'),

+                                          (ldap.MOD_ADD, 'nsMatchingRule', b'nssubstrbegin=3'),

+                                          (ldap.MOD_ADD, 'nsMatchingRule', b'nssubstrend=3'),

+                                          (ldap.MOD_ADD, 'objectClass', b'extensibleObject'),

+                                          (ldap.MOD_ADD, 'nsSubStrBegin', b'2'),

+                                          (ldap.MOD_ADD, 'nsSubStrEnd', b'2')])

      except ldap.LDAPError as e:

-         log.error('Failed to add substr lengths: error ' + e.message['desc'])

+         log.error('Failed to add substr lengths: error {}'.format(e.args[0]['desc']))

          assert False

  

      # restart the server to apply the indexing
@@ -232,7 +232,7 @@ 

              'givenname': 'c',

              'mail': UID})))

      except ldap.LDAPError as e:

-         log.error('Failed to add ' + USER_DN + ': error ' + e.message['desc'])

+         log.error('Failed to add ' + USER_DN + ': error {}'.format(e.args[0]['desc']))

          assert False

  

      entries = topology_st.standalone.search_s(SUFFIX, ldap.SCOPE_SUBTREE, '(uid=c*)')
@@ -317,14 +317,14 @@ 

      # clean up substr setting to UID_INDEX

      try:

          topology_st.standalone.modify_s(UID_INDEX,

-                                         [(ldap.MOD_DELETE, 'nsIndexType', 'sub'),

-                                          (ldap.MOD_DELETE, 'nsMatchingRule', 'nssubstrbegin=3'),

-                                          (ldap.MOD_DELETE, 'nsMatchingRule', 'nssubstrend=3'),

-                                          (ldap.MOD_DELETE, 'objectClass', 'extensibleObject'),

-                                          (ldap.MOD_DELETE, 'nsSubStrBegin', '2'),

-                                          (ldap.MOD_DELETE, 'nsSubStrEnd', '2')])

+                                         [(ldap.MOD_DELETE, 'nsIndexType', b'sub'),

+                                          (ldap.MOD_DELETE, 'nsMatchingRule', b'nssubstrbegin=3'),

+                                          (ldap.MOD_DELETE, 'nsMatchingRule', b'nssubstrend=3'),

+                                          (ldap.MOD_DELETE, 'objectClass', b'extensibleObject'),

+                                          (ldap.MOD_DELETE, 'nsSubStrBegin', b'2'),

+                                          (ldap.MOD_DELETE, 'nsSubStrEnd', b'2')])

      except ldap.LDAPError as e:

-         log.error('Failed to delete substr lengths: error ' + e.message['desc'])

+         log.error('Failed to delete substr lengths: error {}'.format(e.args[0]['desc']))

          assert False

      log.info('Testcase PASSED')

  

@@ -22,7 +22,7 @@ 

      INDEX_DN = 'cn=cn,cn=index,cn=userroot,cn=ldbm database,cn=plugins,cn=config'

      REJECTED = False

      try:

-         topology_st.standalone.modify_s(INDEX_DN, [(ldap.MOD_ADD, 'nsINdexType', 'eq,pres')])

+         topology_st.standalone.modify_s(INDEX_DN, [(ldap.MOD_ADD, 'nsINdexType', b'eq,pres')])

      except ldap.UNWILLING_TO_PERFORM:

          log.info('Index update correctly rejected')

          REJECTED = True

@@ -15,6 +15,7 @@ 

  from lib389 import Entry

  from lib389._constants import *

  from lib389.topologies import topology_st

+ from lib389.nss_ssl import NssSsl

  

  log = logging.getLogger(__name__)

  
@@ -26,7 +27,7 @@ 

  ENCRYPTION_DN = 'cn=encryption,%s' % CONFIG_DN

  RSA = 'RSA'

  RSA_DN = 'cn=%s,%s' % (RSA, ENCRYPTION_DN)

- LDAPSPORT = str(DEFAULT_SECURE_PORT)

+ LDAPSPORT = str(SECUREPORT_STANDALONE)

  SERVERCERT = 'Server-Cert'

  plus_all_ecount = 0

  plus_all_dcount = 0
@@ -47,21 +48,22 @@ 

      """

      _header(topology_st, 'Testing Ticket 48194 - harden the list of ciphers available by default')

  

-     topology_st.standalone.nss_ssl.reinit()

-     topology_st.standalone.nss_ssl.create_rsa_ca()

-     topology_st.standalone.nss_ssl.create_rsa_key_and_cert()

+     nss_ssl = NssSsl(dbpath=topology_st.standalone.get_cert_dir())

+     nss_ssl.reinit()

+     nss_ssl.create_rsa_ca()

+     nss_ssl.create_rsa_key_and_cert()

  

      log.info("\n######################### enable SSL in the directory server with all ciphers ######################\n")

      topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)

-     topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3', 'off'),

-                                                     (ldap.MOD_REPLACE, 'nsTLS1', 'on'),

-                                                     (ldap.MOD_REPLACE, 'nsSSLClientAuth', 'allowed'),

-                                                     (ldap.MOD_REPLACE, 'allowWeakCipher', 'on'),

-                                                     (ldap.MOD_REPLACE, 'nsSSL3Ciphers', '+all')])

+     topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3', b'off'),

+                                                     (ldap.MOD_REPLACE, 'nsTLS1', b'on'),

+                                                     (ldap.MOD_REPLACE, 'nsSSLClientAuth', b'allowed'),

+                                                     (ldap.MOD_REPLACE, 'allowWeakCipher', b'on'),

+                                                     (ldap.MOD_REPLACE, 'nsSSL3Ciphers', b'+all')])

  

-     topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE, 'nsslapd-security', 'on'),

-                                                 (ldap.MOD_REPLACE, 'nsslapd-ssl-check-hostname', 'off'),

-                                                 (ldap.MOD_REPLACE, 'nsslapd-secureport', LDAPSPORT)])

+     topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE, 'nsslapd-security', b'on'),

+                                                 (ldap.MOD_REPLACE, 'nsslapd-ssl-check-hostname', b'off'),

+                                                 (ldap.MOD_REPLACE, 'nsslapd-secureport', ensure_bytes(LDAPSPORT))])

  

      topology_st.standalone.add_s(Entry((RSA_DN, {'objectclass': "top nsEncryptionModule".split(),

                                                   'cn': RSA,
@@ -95,18 +97,18 @@ 

  

      while True:

          l = proc.stdout.readline()

-         if l == "":

+         if l == b"":

              break

-         if 'Cipher is' in l:

+         if b'Cipher is' in l:

              log.info("Found: %s", l)

              if expect:

-                 if '(NONE)' in l:

+                 if b'(NONE)' in l:

                      assert False

                  else:

                      proc.stdin.close()

                      assert True

              else:

-                 if '(NONE)' in l:

+                 if b'(NONE)' in l:

                      assert True

                  else:

                      proc.stdin.close()
@@ -122,7 +124,7 @@ 

      _header(topology_st, 'Test Case 1 - Check the ciphers availability for "+all"; allowWeakCipher: on')

  

      topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)

-     topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', '64')])

+     topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', b'64')])

  

      log.info("\n######################### Restarting the server ######################\n")

      topology_st.standalone.restart(timeout=120)
@@ -140,7 +142,7 @@ 

      _header(topology_st, 'Test Case 2 - Check the ciphers availability for "+all" with default allowWeakCiphers')

  

      topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)

-     topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', '64')])

+     topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', b'64')])

      # Make sure allowWeakCipher is not set.

      topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_DELETE, 'allowWeakCipher', None)])

  
@@ -166,7 +168,7 @@ 

  

      topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)

      topology_st.standalone.modify_s(ENCRYPTION_DN,

-                                     [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', '+rsa_aes_128_sha,+rsa_aes_256_sha')])

+                                     [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', b'+rsa_aes_128_sha,+rsa_aes_256_sha')])

  

      log.info("\n######################### Restarting the server ######################\n")

      topology_st.standalone.stop(timeout=10)
@@ -190,7 +192,7 @@ 

      _header(topology_st, 'Test Case 4 - Check the ciphers availability for "-all"')

  

      topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)

-     topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', '-all')])

+     topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', b'-all')])

  

      log.info("\n######################### Restarting the server ######################\n")

      topology_st.standalone.stop(timeout=10)
@@ -212,7 +214,7 @@ 

      _header(topology_st, 'Test Case 5 - Check no nsSSL3Ciphers (-all) with default allowWeakCipher')

  

      topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)

-     topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_DELETE, 'nsSSL3Ciphers', '-all')])

+     topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_DELETE, 'nsSSL3Ciphers', b'-all')])

  

      log.info("\n######################### Restarting the server ######################\n")

      topology_st.standalone.stop(timeout=10)
@@ -234,7 +236,7 @@ 

      _header(topology_st, 'Test Case 6 - Check default nsSSL3Ciphers (default setting) with default allowWeakCipher')

  

      topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)

-     topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', 'default')])

+     topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', b'default')])

  

      log.info("\n######################### Restarting the server ######################\n")

      topology_st.standalone.stop(timeout=10)
@@ -258,7 +260,7 @@ 

  

      topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)

      topology_st.standalone.modify_s(ENCRYPTION_DN,

-                                     [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', '+all,-TLS_RSA_WITH_AES_256_CBC_SHA256')])

+                                     [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', b'+all,-TLS_RSA_WITH_AES_256_CBC_SHA256')])

  

      log.info("\n######################### Restarting the server ######################\n")

      topology_st.standalone.stop(timeout=10)
@@ -280,8 +282,8 @@ 

      _header(topology_st, 'Test Case 9 - Check default nsSSL3Ciphers (default setting + allowWeakCipher: off)')

  

      topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)

-     topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', 'default'),

-                                                     (ldap.MOD_REPLACE, 'allowWeakCipher', 'off')])

+     topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', b'default'),

+                                                     (ldap.MOD_REPLACE, 'allowWeakCipher', b'off')])

  

      log.info("\n######################### Restarting the server ######################\n")

      topology_st.standalone.stop(timeout=10)
@@ -306,7 +308,7 @@ 

  

      topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)

      topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', None),

-                                                     (ldap.MOD_REPLACE, 'allowWeakCipher', 'on')])

+                                                     (ldap.MOD_REPLACE, 'allowWeakCipher', b'on')])

      topology_st.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE, 'nsslapd-errorlog-level', None)])

  

      log.info("\n######################### Restarting the server ######################\n")
@@ -328,7 +330,7 @@ 

      _header(topology_st, 'Test Case 12 - Check nsSSL3Ciphers: +fortezza, which is not supported')

  

      topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)

-     topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', '+fortezza')])

+     topology_st.standalone.modify_s(ENCRYPTION_DN, [(ldap.MOD_REPLACE, 'nsSSL3Ciphers', b'+fortezza')])

  

      log.info("\n######################### Restarting the server ######################\n")

      topology_st.standalone.stop(timeout=10)

@@ -15,7 +15,7 @@ 

  

  def runDbVerify(topology_st):

      topology_st.standalone.log.info("\n\n	+++++ dbverify +++++\n")

-     sbin_dir = get_sbin_dir(prefix=topology_st.standalone.prefix)

+     sbin_dir = get_sbin_dir()

      dbverifyCMD = sbin_dir + "/dbverify -Z " + topology_st.standalone.serverid + " -V"

      dbverifyOUT = os.popen(dbverifyCMD, "r")

      topology_st.standalone.log.info("Running %s" % dbverifyCMD)
@@ -69,7 +69,7 @@ 

      topology_st.standalone.simple_bind_s(DN_DM, PASSWORD)

  

      data_dir_path = topology_st.standalone.getDir(__file__, DATA_DIR)

-     ldif_file = data_dir_path + "ticket48212/" + _MYLDIF

+     ldif_file = f"{data_dir_path}ticket48212/{_MYLDIF}"

      try:

          ldif_dir = topology_st.standalone.get_ldif_dir()

          shutil.copy(ldif_file, ldif_dir)
@@ -103,7 +103,7 @@ 

  

      topology_st.standalone.log.info("\n\n######################### Add nsMatchingRule ######################\n")

      try:

-         topology_st.standalone.modify_s(UIDNUMBERDN, [(ldap.MOD_ADD, 'nsMatchingRule', 'integerOrderingMatch')])

+         topology_st.standalone.modify_s(UIDNUMBERDN, [(ldap.MOD_ADD, 'nsMatchingRule', b'integerOrderingMatch')])

      except ValueError:

          topology_st.standalone.log.fatal("modify_s failed: %s", ValueError)

  
@@ -114,7 +114,7 @@ 

  

      topology_st.standalone.log.info("\n\n######################### Delete nsMatchingRule ######################\n")

      try:

-         topology_st.standalone.modify_s(UIDNUMBERDN, [(ldap.MOD_DELETE, 'nsMatchingRule', 'integerOrderingMatch')])

+         topology_st.standalone.modify_s(UIDNUMBERDN, [(ldap.MOD_DELETE, 'nsMatchingRule', b'integerOrderingMatch')])

      except ValueError:

          topology_st.standalone.log.fatal("modify_s failed: %s", ValueError)

  

@@ -85,12 +85,12 @@ 

      checkMaxBerSize(topology_st)

  

      topology_st.standalone.log.info("\n\n######################### Add nsslapd-maxbersize: 0 ######################\n")

-     topology_st.standalone.modify_s('cn=config', [(ldap.MOD_REPLACE, 'nsslapd-maxbersize', '0')])

+     topology_st.standalone.modify_s('cn=config', [(ldap.MOD_REPLACE, 'nsslapd-maxbersize', b'0')])

      checkMaxBerSize(topology_st)

  

      topology_st.standalone.log.info(

          "\n\n######################### Add nsslapd-maxbersize: 10000 ######################\n")

-     topology_st.standalone.modify_s('cn=config', [(ldap.MOD_REPLACE, 'nsslapd-maxbersize', '10000')])

+     topology_st.standalone.modify_s('cn=config', [(ldap.MOD_REPLACE, 'nsslapd-maxbersize', b'10000')])

      checkMaxBerSize(topology_st)

  

      topology_st.standalone.log.info("ticket48214 was successfully verified.")

@@ -19,9 +19,9 @@ 

                  '(userdn = "ldap:///anyone") and (ip="127.0.0.1");)')

  

      try:

-         topology_st.standalone.modify_s(DEFAULT_SUFFIX, [(ldap.MOD_ADD, 'aci', aci_text)])

+         topology_st.standalone.modify_s(DEFAULT_SUFFIX, [(ldap.MOD_ADD, 'aci', ensure_bytes(aci_text))])

      except ldap.LDAPError as e:

-         log.error('Failed to add aci: (%s) error %s' % (aci_text, e.message['desc']))

+         log.error('Failed to add aci: ({}) error {}'.format(aci_text,e.args[0]['desc']))

          assert False

      time.sleep(1)

  
@@ -29,7 +29,7 @@ 

      try:

          topology_st.standalone.simple_bind_s("", "")

      except ldap.LDAPError as e:

-         log.error('Failed to anonymously bind -error %s' % (e.message['desc']))

+         log.error('Failed to anonymously bind -error {}'.format(e.args[0]['desc']))

          assert False

  

      try:

@@ -43,12 +43,12 @@ 

      try:

          topology_st.standalone.modify_s(DN, [(ldap.MOD_DELETE,

                                                'mail',

-                                               'user0099@dev.null'),

+                                               b'user0099@dev.null'),

                                               (ldap.MOD_DELETE,

                                                'mail',

-                                               'alias@dev.null'),

+                                               b'alias@dev.null'),

                                               (ldap.MOD_ADD,

-                                               'mail', 'user0099@dev.null')])

+                                               'mail', b'user0099@dev.null')])

      except ldap.LDAPError as e:

          log.fatal('Failedto modify user: ' + str(e))

          assert False
@@ -87,10 +87,10 @@ 

      try:

          topology_st.standalone.modify_s(DN, [(ldap.MOD_DELETE,

                                                'mail',

-                                               'user0099@dev.null'),

+                                               b'user0099@dev.null'),

                                               (ldap.MOD_DELETE,

                                                'mail',

-                                               'user0099@redhat.com')

+                                               b'user0099@redhat.com')

                                               ])

      except ldap.LDAPError as e:

          log.fatal('Failed to modify user: ' + str(e))
@@ -132,8 +132,8 @@ 

      try:

          topology_st.standalone.modify_s(DN, [(ldap.MOD_ADD,

                                                'mail',

-                                               ['user0099@dev.null',

-                                                'alias@dev.null'])])

+                                               [b'user0099@dev.null',

+                                                b'alias@dev.null'])])

      except ldap.LDAPError as e:

          log.fatal('Failedto modify user: ' + str(e))

          assert False
@@ -144,12 +144,12 @@ 

      try:

          topology_st.standalone.modify_s(DN, [(ldap.MOD_DELETE,

                                                'mail',

-                                               'alias@dev.null'),

+                                               b'alias@dev.null'),

                                               (ldap.MOD_DELETE,

                                                'mail',

-                                               'user0099@dev.null'),

+                                               b'user0099@dev.null'),

                                               (ldap.MOD_ADD,

-                                               'mail', 'user0099@dev.null')])

+                                               'mail', b'user0099@dev.null')])

      except ldap.LDAPError as e:

          log.fatal('Failedto modify user: ' + str(e))

          assert False

@@ -30,7 +30,7 @@ 

      # Create some stupid huge objects / attributes in DS.

      # seeAlso is indexed by default. Lets do that!

      # This will take a while ...

-     data = [random.choice(string.letters) for x in xrange(10000000)]

+     data = [random.choice(string.ascii_letters) for x in range(10000000)]

      s = "".join(data)

  

      # This was here for an iteration test.
@@ -50,18 +50,14 @@ 

          'padding': padding,

      }))

  

-     try:

-         topology_st.standalone.add_s(user)

-     except ldap.LDAPError as e:

-         log.fatal('test 48383: Failed to user%s: error %s ' % (i, e.message['desc']))

-         assert False

+     topology_st.standalone.add_s(user)

  

      # Set the dbsize really low.

      try:

          topology_st.standalone.modify_s(DEFAULT_BENAME, [(ldap.MOD_REPLACE,

-                                                           'nsslapd-cachememsize', '1')])

+                                                           'nsslapd-cachememsize', b'1')])

      except ldap.LDAPError as e:

-         log.fatal('Failed to change nsslapd-cachememsize ' + e.message['desc'])

+         log.fatal('Failed to change nsslapd-cachememsize {}'.format(e.args[0]['desc']))

  

      ## Does ds try and set a minimum possible value for this?

      ## Yes: [16/Feb/2016:16:39:18 +1000] - WARNING: cache too small, increasing to 500K bytes

Description: Added py3 support by explicitly changing strings to bytes.

https://pagure.io/389-ds-base/issue/49588

Reviewed by: ??

rebased onto 512e63dada7c8ecd3adf344d5769a7b154a13ab3

5 years ago

rebased onto 8ed138f1114f9f684c330c62ad3feaf251f36b17

5 years ago

rebased onto 99db5dad88f182c5ef12fcd4fa8d4575309d6f94

5 years ago

rebased onto 07112d043e3f13cbab4653f04031acc54758cf4c

5 years ago

rebased onto 31ff8e12abafa7a50c0034ff67b6999580a919ed

5 years ago

rebased onto b281682eafc9697525112f8b776c534d2c77fb19

5 years ago

Let's not keep non-working code commented out, it's better to remove it to avoid confusion.

That's a bit too wordy compared to the the original, maybe just change e.message to e.args[0] and that's it?

Switched to a new branch 'pr/49758'
[root@server ds]# py.test -v $(git show --pretty="" --name-only HEAD)
============================================================ test session starts ============================================================
platform linux -- Python 3.6.5, pytest-3.6.2, py-1.5.3, pluggy-0.6.0 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /workspace/ds, inifile:
collected 156 items                                                                                                                         

dirsrvtests/tests/tickets/ticket47560_test.py::test_ticket47560 PASSED                                                                [  0%]
dirsrvtests/tests/tickets/ticket47573_test.py::test_ticket47573_init PASSED                                                           [  1%]
dirsrvtests/tests/tickets/ticket47573_test.py::test_ticket47573_one PASSED                                                            [  1%]
dirsrvtests/tests/tickets/ticket47573_test.py::test_ticket47573_two PASSED                                                            [  2%]
dirsrvtests/tests/tickets/ticket47573_test.py::test_ticket47573_three PASSED                                                          [  3%]
dirsrvtests/tests/tickets/ticket47640_test.py::test_ticket47640 PASSED                                                                [  3%]
dirsrvtests/tests/tickets/ticket47653MMR_test.py::test_ticket47653_init PASSED                                                        [  4%]
dirsrvtests/tests/tickets/ticket47653MMR_test.py::test_ticket47653_add PASSED                                                         [  5%]
dirsrvtests/tests/tickets/ticket47653MMR_test.py::test_ticket47653_modify PASSED                                                      [  5%]
dirsrvtests/tests/tickets/ticket47676_test.py::test_ticket47676_init PASSED                                                           [  6%]
dirsrvtests/tests/tickets/ticket47676_test.py::test_ticket47676_skip_oc_at PASSED                                                     [  7%]
dirsrvtests/tests/tickets/ticket47676_test.py::test_ticket47676_reject_action PASSED                                                  [  7%]
dirsrvtests/tests/tickets/ticket47714_test.py::test_ticket47714_init PASSED                                                           [  8%]
dirsrvtests/tests/tickets/ticket47714_test.py::test_ticket47714_run_0 PASSED                                                          [  8%]
dirsrvtests/tests/tickets/ticket47714_test.py::test_ticket47714_run_1 PASSED                                                          [  9%]
dirsrvtests/tests/tickets/ticket47721_test.py::test_ticket47721_init PASSED                                                           [ 10%]
dirsrvtests/tests/tickets/ticket47721_test.py::test_ticket47721_0 PASSED                                                              [ 10%]
dirsrvtests/tests/tickets/ticket47721_test.py::test_ticket47721_1 PASSED                                                              [ 11%]
dirsrvtests/tests/tickets/ticket47721_test.py::test_ticket47721_2 PASSED                                                              [ 12%]
dirsrvtests/tests/tickets/ticket47721_test.py::test_ticket47721_3 PASSED                                                              [ 12%]
dirsrvtests/tests/tickets/ticket47721_test.py::test_ticket47721_4 PASSED                                                              [ 13%]
dirsrvtests/tests/tickets/ticket47781_test.py::test_ticket47781 PASSED                                                                [ 14%]
dirsrvtests/tests/tickets/ticket47787_test.py::test_ticket47787_init PASSED                                                           [ 14%]
dirsrvtests/tests/tickets/ticket47787_test.py::test_ticket47787_2 PASSED                                                              [ 15%]
dirsrvtests/tests/tickets/ticket47808_test.py::test_ticket47808_run PASSED                                                            [ 16%]
dirsrvtests/tests/tickets/ticket47819_test.py::test_ticket47819 PASSED                                                                [ 16%]
dirsrvtests/tests/tickets/ticket47823_test.py::test_ticket47823_init PASSED                                                           [ 17%]
dirsrvtests/tests/tickets/ticket47823_test.py::test_ticket47823_one_container_add PASSED                                              [ 17%]
dirsrvtests/tests/tickets/ticket47823_test.py::test_ticket47823_one_container_mod PASSED                                              [ 18%]
dirsrvtests/tests/tickets/ticket47823_test.py::test_ticket47823_one_container_modrdn PASSED                                           [ 19%]
dirsrvtests/tests/tickets/ticket47823_test.py::test_ticket47823_multi_containers_add PASSED                                           [ 19%]
dirsrvtests/tests/tickets/ticket47823_test.py::test_ticket47823_multi_containers_mod PASSED                                           [ 20%]
dirsrvtests/tests/tickets/ticket47823_test.py::test_ticket47823_multi_containers_modrdn PASSED                                        [ 21%]
dirsrvtests/tests/tickets/ticket47823_test.py::test_ticket47823_across_multi_containers_add PASSED                                    [ 21%]
dirsrvtests/tests/tickets/ticket47823_test.py::test_ticket47823_across_multi_containers_mod PASSED                                    [ 22%]
dirsrvtests/tests/tickets/ticket47823_test.py::test_ticket47823_across_multi_containers_modrdn PASSED                                 [ 23%]
dirsrvtests/tests/tickets/ticket47823_test.py::test_ticket47823_invalid_config_1 PASSED                                               [ 23%]
dirsrvtests/tests/tickets/ticket47823_test.py::test_ticket47823_invalid_config_2 PASSED                                               [ 24%]
dirsrvtests/tests/tickets/ticket47823_test.py::test_ticket47823_invalid_config_3 PASSED                                               [ 25%]
dirsrvtests/tests/tickets/ticket47823_test.py::test_ticket47823_invalid_config_4 PASSED                                               [ 25%]
dirsrvtests/tests/tickets/ticket47823_test.py::test_ticket47823_invalid_config_5 PASSED                                               [ 26%]
dirsrvtests/tests/tickets/ticket47823_test.py::test_ticket47823_invalid_config_6 PASSED                                               [ 26%]
dirsrvtests/tests/tickets/ticket47823_test.py::test_ticket47823_invalid_config_7 PASSED                                               [ 27%]
dirsrvtests/tests/tickets/ticket47828_test.py::test_ticket47828_init PASSED                                                           [ 28%]
dirsrvtests/tests/tickets/ticket47828_test.py::test_ticket47828_run_0 PASSED                                                          [ 28%]
dirsrvtests/tests/tickets/ticket47828_test.py::test_ticket47828_run_1 PASSED                                                          [ 29%]
dirsrvtests/tests/tickets/ticket47828_test.py::test_ticket47828_run_2 PASSED                                                          [ 30%]
dirsrvtests/tests/tickets/ticket47828_test.py::test_ticket47828_run_3 PASSED                                                          [ 30%]
dirsrvtests/tests/tickets/ticket47828_test.py::test_ticket47828_run_4 PASSED                                                          [ 31%]
dirsrvtests/tests/tickets/ticket47828_test.py::test_ticket47828_run_5 PASSED                                                          [ 32%]
dirsrvtests/tests/tickets/ticket47828_test.py::test_ticket47828_run_6 PASSED                                                          [ 32%]
dirsrvtests/tests/tickets/ticket47828_test.py::test_ticket47828_run_7 PASSED                                                          [ 33%]
dirsrvtests/tests/tickets/ticket47828_test.py::test_ticket47828_run_8 PASSED                                                          [ 33%]
dirsrvtests/tests/tickets/ticket47828_test.py::test_ticket47828_run_9 PASSED                                                          [ 34%]
dirsrvtests/tests/tickets/ticket47828_test.py::test_ticket47828_run_10 PASSED                                                         [ 35%]
dirsrvtests/tests/tickets/ticket47828_test.py::test_ticket47828_run_11 PASSED                                                         [ 35%]
dirsrvtests/tests/tickets/ticket47828_test.py::test_ticket47828_run_12 PASSED                                                         [ 36%]
dirsrvtests/tests/tickets/ticket47828_test.py::test_ticket47828_run_13 PASSED                                                         [ 37%]
dirsrvtests/tests/tickets/ticket47828_test.py::test_ticket47828_run_14 PASSED                                                         [ 37%]
dirsrvtests/tests/tickets/ticket47828_test.py::test_ticket47828_run_15 PASSED                                                         [ 38%]
dirsrvtests/tests/tickets/ticket47828_test.py::test_ticket47828_run_16 PASSED                                                         [ 39%]
dirsrvtests/tests/tickets/ticket47828_test.py::test_ticket47828_run_17 PASSED                                                         [ 39%]
dirsrvtests/tests/tickets/ticket47828_test.py::test_ticket47828_run_18 PASSED                                                         [ 40%]
dirsrvtests/tests/tickets/ticket47828_test.py::test_ticket47828_run_19 PASSED                                                         [ 41%]
dirsrvtests/tests/tickets/ticket47828_test.py::test_ticket47828_run_20 PASSED                                                         [ 41%]
dirsrvtests/tests/tickets/ticket47828_test.py::test_ticket47828_run_21 PASSED                                                         [ 42%]
dirsrvtests/tests/tickets/ticket47828_test.py::test_ticket47828_run_22 PASSED                                                         [ 42%]
dirsrvtests/tests/tickets/ticket47828_test.py::test_ticket47828_run_23 PASSED                                                         [ 43%]
dirsrvtests/tests/tickets/ticket47828_test.py::test_ticket47828_run_24 PASSED                                                         [ 44%]
dirsrvtests/tests/tickets/ticket47828_test.py::test_ticket47828_run_25 PASSED                                                         [ 44%]
dirsrvtests/tests/tickets/ticket47828_test.py::test_ticket47828_run_26 PASSED                                                         [ 45%]
dirsrvtests/tests/tickets/ticket47828_test.py::test_ticket47828_run_27 PASSED                                                         [ 46%]
dirsrvtests/tests/tickets/ticket47828_test.py::test_ticket47828_run_28 PASSED                                                         [ 46%]
dirsrvtests/tests/tickets/ticket47828_test.py::test_ticket47828_run_29 PASSED                                                         [ 47%]
dirsrvtests/tests/tickets/ticket47828_test.py::test_ticket47828_run_30 PASSED                                                         [ 48%]
dirsrvtests/tests/tickets/ticket47828_test.py::test_ticket47828_run_31 PASSED                                                         [ 48%]
dirsrvtests/tests/tickets/ticket47829_test.py::test_ticket47829_init PASSED                                                           [ 49%]
dirsrvtests/tests/tickets/ticket47829_test.py::test_ticket47829_mod_active_user_1 PASSED                                              [ 50%]
dirsrvtests/tests/tickets/ticket47829_test.py::test_ticket47829_mod_active_user_2 PASSED                                              [ 50%]
dirsrvtests/tests/tickets/ticket47829_test.py::test_ticket47829_mod_active_user_3 PASSED                                              [ 51%]
dirsrvtests/tests/tickets/ticket47829_test.py::test_ticket47829_mod_stage_user_1 PASSED                                               [ 51%]
dirsrvtests/tests/tickets/ticket47829_test.py::test_ticket47829_mod_stage_user_2 PASSED                                               [ 52%]
dirsrvtests/tests/tickets/ticket47829_test.py::test_ticket47829_mod_stage_user_3 PASSED                                               [ 53%]
dirsrvtests/tests/tickets/ticket47829_test.py::test_ticket47829_mod_out_user_1 PASSED                                                 [ 53%]
dirsrvtests/tests/tickets/ticket47829_test.py::test_ticket47829_mod_out_user_2 PASSED                                                 [ 54%]
dirsrvtests/tests/tickets/ticket47829_test.py::test_ticket47829_mod_out_user_3 PASSED                                                 [ 55%]
dirsrvtests/tests/tickets/ticket47829_test.py::test_ticket47829_mod_active_user_modrdn_active_user_1 PASSED                           [ 55%]
dirsrvtests/tests/tickets/ticket47829_test.py::test_ticket47829_mod_active_user_modrdn_stage_user_1 PASSED                            [ 56%]
dirsrvtests/tests/tickets/ticket47829_test.py::test_ticket47829_mod_active_user_modrdn_out_user_1 PASSED                              [ 57%]
dirsrvtests/tests/tickets/ticket47829_test.py::test_ticket47829_mod_modrdn_1 PASSED                                                   [ 57%]
dirsrvtests/tests/tickets/ticket47829_test.py::test_ticket47829_mod_stage_user_modrdn_active_user_1 PASSED                            [ 58%]
dirsrvtests/tests/tickets/ticket47829_test.py::test_ticket47829_mod_stage_user_modrdn_stage_user_1 PASSED                             [ 58%]
dirsrvtests/tests/tickets/ticket47829_test.py::test_ticket47829_indirect_active_group_1 PASSED                                        [ 59%]
dirsrvtests/tests/tickets/ticket47829_test.py::test_ticket47829_indirect_active_group_2 PASSED                                        [ 60%]
dirsrvtests/tests/tickets/ticket47829_test.py::test_ticket47829_indirect_active_group_3 PASSED                                        [ 60%]
dirsrvtests/tests/tickets/ticket47829_test.py::test_ticket47829_indirect_active_group_4 PASSED                                        [ 61%]
dirsrvtests/tests/tickets/ticket47833_test.py::test_ticket47829_init PASSED                                                           [ 62%]
dirsrvtests/tests/tickets/ticket47833_test.py::test_ticket47829_mod_stage_user_modrdn_stage_user_1 PASSED                             [ 62%]
dirsrvtests/tests/tickets/ticket47838_test.py::test_47838_init FAILED                                                                 [ 63%]
dirsrvtests/tests/tickets/ticket47838_test.py::test_47838_run_0 PASSED                                                                [ 64%]
dirsrvtests/tests/tickets/ticket47838_test.py::test_47838_run_1 PASSED                                                                [ 64%]
dirsrvtests/tests/tickets/ticket47838_test.py::test_47838_run_2 PASSED                                                                [ 65%]
dirsrvtests/tests/tickets/ticket47838_test.py::test_47838_run_3 PASSED                                                                [ 66%]
dirsrvtests/tests/tickets/ticket47838_test.py::test_47838_run_4 FAILED                                                                [ 66%]
dirsrvtests/tests/tickets/ticket47838_test.py::test_47838_run_5 FAILED                                                                [ 67%]
dirsrvtests/tests/tickets/ticket47838_test.py::test_47838_run_6 PASSED                                                                [ 67%]
dirsrvtests/tests/tickets/ticket47838_test.py::test_47838_run_7 PASSED                                                                [ 68%]
dirsrvtests/tests/tickets/ticket47838_test.py::test_47838_run_8 FAILED                                                                [ 69%]
dirsrvtests/tests/tickets/ticket47838_test.py::test_47838_run_9 FAILED                                                                [ 69%]
dirsrvtests/tests/tickets/ticket47838_test.py::test_47838_run_10 PASSED                                                               [ 70%]
dirsrvtests/tests/tickets/ticket47838_test.py::test_47838_run_11 PASSED                                                               [ 71%]
dirsrvtests/tests/tickets/ticket47838_test.py::test_47928_run_0 PASSED                                                                [ 71%]
dirsrvtests/tests/tickets/ticket47838_test.py::test_47928_run_1 PASSED                                                                [ 72%]
dirsrvtests/tests/tickets/ticket47838_test.py::test_47928_run_2 PASSED                                                                [ 73%]
dirsrvtests/tests/tickets/ticket47838_test.py::test_47928_run_3 PASSED                                                                [ 73%]
dirsrvtests/tests/tickets/ticket47838_test.py::test_47838_run_last PASSED                                                             [ 74%]
dirsrvtests/tests/tickets/ticket47869MMR_test.py::test_ticket47869_init PASSED                                                        [ 75%]
dirsrvtests/tests/tickets/ticket47869MMR_test.py::test_ticket47869_check PASSED                                                       [ 75%]
dirsrvtests/tests/tickets/ticket47871_test.py::test_ticket47871_init PASSED                                                           [ 76%]
dirsrvtests/tests/tickets/ticket47871_test.py::test_ticket47871_1 PASSED                                                              [ 76%]
dirsrvtests/tests/tickets/ticket47871_test.py::test_ticket47871_2 PASSED                                                              [ 77%]
dirsrvtests/tests/tickets/ticket47900_test.py::test_ticket47900 PASSED                                                                [ 78%]
dirsrvtests/tests/tickets/ticket47910_test.py::test_ticket47910_logconv_start_end_positive PASSED                                     [ 78%]
dirsrvtests/tests/tickets/ticket47910_test.py::test_ticket47910_logconv_start_end_negative PASSED                                     [ 79%]
dirsrvtests/tests/tickets/ticket47910_test.py::test_ticket47910_logconv_start_end_invalid PASSED                                      [ 80%]
dirsrvtests/tests/tickets/ticket47910_test.py::test_ticket47910_logconv_noaccesslogs PASSED                                           [ 80%]
dirsrvtests/tests/tickets/ticket47920_test.py::test_ticket47920_init PASSED                                                           [ 81%]
dirsrvtests/tests/tickets/ticket47920_test.py::test_ticket47920_mod_readentry_ctrl PASSED                                             [ 82%]
dirsrvtests/tests/tickets/ticket47921_test.py::test_ticket47921 PASSED                                                                [ 82%]
dirsrvtests/tests/tickets/ticket47988_test.py::test_ticket47988_init FAILED                                                           [ 83%]
dirsrvtests/tests/tickets/ticket47988_test.py::test_ticket47988_1 FAILED                                                              [ 83%]
dirsrvtests/tests/tickets/ticket47988_test.py::test_ticket47988_2 FAILED                                                              [ 84%]
dirsrvtests/tests/tickets/ticket47988_test.py::test_ticket47988_3 FAILED                                                              [ 85%]
dirsrvtests/tests/tickets/ticket47988_test.py::test_ticket47988_4 FAILED                                                              [ 85%]
dirsrvtests/tests/tickets/ticket47988_test.py::test_ticket47988_5 FAILED                                                              [ 86%]
dirsrvtests/tests/tickets/ticket47988_test.py::test_ticket47988_6 FAILED                                                              [ 87%]
dirsrvtests/tests/tickets/ticket48013_test.py::test_ticket48013 PASSED                                                                [ 87%]
dirsrvtests/tests/tickets/ticket48026_test.py::test_ticket48026 PASSED                                                                [ 88%]
dirsrvtests/tests/tickets/ticket48109_test.py::test_ticket48109 PASSED                                                                [ 89%]
dirsrvtests/tests/tickets/ticket48170_test.py::test_ticket48170 PASSED                                                                [ 89%]
dirsrvtests/tests/tickets/ticket48194_test.py::test_init FAILED                                                                       [ 90%]
dirsrvtests/tests/tickets/ticket48194_test.py::test_run_0 FAILED                                                                      [ 91%]
dirsrvtests/tests/tickets/ticket48194_test.py::test_run_1 PASSED                                                                      [ 91%]
dirsrvtests/tests/tickets/ticket48194_test.py::test_run_2 PASSED                                                                      [ 92%]
dirsrvtests/tests/tickets/ticket48194_test.py::test_run_3 PASSED                                                                      [ 92%]
dirsrvtests/tests/tickets/ticket48194_test.py::test_run_4 PASSED                                                                      [ 93%]
dirsrvtests/tests/tickets/ticket48194_test.py::test_run_5 PASSED                                                                      [ 94%]
dirsrvtests/tests/tickets/ticket48194_test.py::test_run_6 PASSED                                                                      [ 94%]
dirsrvtests/tests/tickets/ticket48194_test.py::test_run_8 PASSED                                                                      [ 95%]
dirsrvtests/tests/tickets/ticket48194_test.py::test_run_9 FAILED                                                                      [ 96%]
dirsrvtests/tests/tickets/ticket48194_test.py::test_run_11 PASSED                                                                     [ 96%]
dirsrvtests/tests/tickets/ticket48212_test.py::test_ticket48212 PASSED                                                                [ 97%]
dirsrvtests/tests/tickets/ticket48214_test.py::test_ticket48214_run PASSED                                                            [ 98%]
dirsrvtests/tests/tickets/ticket48233_test.py::test_ticket48233 PASSED                                                                [ 98%]
dirsrvtests/tests/tickets/ticket48370_test.py::test_ticket48370 PASSED                                                                [ 99%]
dirsrvtests/tests/tickets/ticket48383_test.py::test_ticket48383 PASSED                                                                [100%]

================================================= 15 failed, 141 passed in 1086.07 seconds ==================================================

Good work! I propose that we merge changes for the passing test cases and keep working on the rest in a next batch.

rebased onto 1d37b101c95a3acf8c3e0399a1121312b166515b

5 years ago

rebased onto 97c32eae5505fc165b43a11ed186cdc26e2e4e29

5 years ago

rebased onto c0a80d2

5 years ago

Pull-Request has been merged by vashirov

5 years ago

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This pull request has been cloned to Github as issue and is available here:
- https://github.com/389ds/389-ds-base/issues/2817

If you want to continue to work on the PR, please navigate to the github issue,
download the patch from the attachments and file a new pull request.

Thank you for understanding. We apologize for all inconvenience.

Pull-Request has been closed by spichugi

3 years ago
Metadata
Changes Summary 33
+4 -3
file changed
dirsrvtests/tests/tickets/ticket47560_test.py
+3 -2
file changed
dirsrvtests/tests/tickets/ticket47573_test.py
+1 -1
file changed
dirsrvtests/tests/tickets/ticket47640_test.py
+15 -15
file changed
dirsrvtests/tests/tickets/ticket47653MMR_test.py
+26 -44
file changed
dirsrvtests/tests/tickets/ticket47676_test.py
+18 -18
file changed
dirsrvtests/tests/tickets/ticket47714_test.py
+35 -71
file changed
dirsrvtests/tests/tickets/ticket47721_test.py
+30 -50
file changed
dirsrvtests/tests/tickets/ticket47781_test.py
+9 -7
file changed
dirsrvtests/tests/tickets/ticket47787_test.py
+3 -2
file changed
dirsrvtests/tests/tickets/ticket47808_test.py
+8 -6
file changed
dirsrvtests/tests/tickets/ticket47819_test.py
+9 -9
file changed
dirsrvtests/tests/tickets/ticket47823_test.py
+61 -61
file changed
dirsrvtests/tests/tickets/ticket47828_test.py
+15 -15
file changed
dirsrvtests/tests/tickets/ticket47829_test.py
+3 -3
file changed
dirsrvtests/tests/tickets/ticket47833_test.py
+46 -48
file changed
dirsrvtests/tests/tickets/ticket47838_test.py
+15 -26
file changed
dirsrvtests/tests/tickets/ticket47869MMR_test.py
+2 -2
file changed
dirsrvtests/tests/tickets/ticket47871_test.py
+31 -98
file changed
dirsrvtests/tests/tickets/ticket47900_test.py
+6 -4
file changed
dirsrvtests/tests/tickets/ticket47910_test.py
+3 -3
file changed
dirsrvtests/tests/tickets/ticket47920_test.py
+36 -60
file changed
dirsrvtests/tests/tickets/ticket47921_test.py
+6 -5
file changed
dirsrvtests/tests/tickets/ticket47988_test.py
+5 -4
file changed
dirsrvtests/tests/tickets/ticket48013_test.py
+4 -4
file changed
dirsrvtests/tests/tickets/ticket48026_test.py
+35 -35
file changed
dirsrvtests/tests/tickets/ticket48109_test.py
+1 -1
file changed
dirsrvtests/tests/tickets/ticket48170_test.py
+29 -27
file changed
dirsrvtests/tests/tickets/ticket48194_test.py
+4 -4
file changed
dirsrvtests/tests/tickets/ticket48212_test.py
+2 -2
file changed
dirsrvtests/tests/tickets/ticket48214_test.py
+3 -3
file changed
dirsrvtests/tests/tickets/ticket48233_test.py
+10 -10
file changed
dirsrvtests/tests/tickets/ticket48370_test.py
+4 -8
file changed
dirsrvtests/tests/tickets/ticket48383_test.py