ticket48170_test.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # --- BEGIN COPYRIGHT BLOCK ---
  2. # Copyright (C) 2016 Red Hat, Inc.
  3. # All rights reserved.
  4. #
  5. # License: GPL (version 3 or any later version).
  6. # See LICENSE for details.
  7. # --- END COPYRIGHT BLOCK ---
  8. #
  9. import pytest
  10. from lib389.utils import *
  11. from lib389.topologies import topology_st
  12. logging.getLogger(__name__).setLevel(logging.DEBUG)
  13. log = logging.getLogger(__name__)
  14. def test_ticket48170(topology_st):
  15. '''
  16. Attempt to add a nsIndexType wikth an invalid value: "eq,pres"
  17. '''
  18. INDEX_DN = 'cn=cn,cn=index,cn=userroot,cn=ldbm database,cn=plugins,cn=config'
  19. REJECTED = False
  20. try:
  21. topology_st.standalone.modify_s(INDEX_DN, [(ldap.MOD_ADD, 'nsINdexType', 'eq,pres')])
  22. except ldap.UNWILLING_TO_PERFORM:
  23. log.info('Index update correctly rejected')
  24. REJECTED = True
  25. if not REJECTED:
  26. log.fatal('Invalid nsIndexType value was incorrectly accepted.')
  27. assert False
  28. log.info('Test complete')
  29. if __name__ == '__main__':
  30. # Run isolated
  31. # -s for DEBUG mode
  32. CURRENT_FILE = os.path.realpath(__file__)
  33. pytest.main("-s %s" % CURRENT_FILE)