Skip to content

Commit

Permalink
Issue 4719 - Dsconf fails to add a PTA URL due to an invalid check.
Browse files Browse the repository at this point in the history
Description: This test checks that you are able to add a PTA URL through dsconf.

Relates: #4719

Reviewed by: ???
  • Loading branch information
v-cech committed Jul 3, 2023
1 parent f2c1e44 commit a9a1db2
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
49 changes: 49 additions & 0 deletions dirsrvtests/tests/suites/clu/dsconf_pta_add_url_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# --- BEGIN COPYRIGHT BLOCK ---
# Copyright (C) 2023 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
# See LICENSE for details.
# --- END COPYRIGHT BLOCK ---
#
import pytest
import os
import logging

from lib389.topologies import topology_st
from lib389.cli_conf.plugins.ldappassthrough import pta_add
from lib389._constants import DEFAULT_SUFFIX
from lib389.cli_base import FakeArgs
from . import check_value_in_log_and_reset

logging.getLogger(__name__).setLevel(logging.DEBUG)
log = logging.getLogger(__name__)
new_url = "ldap://localhost:7389/o=redhat"


def test_dsconf_add_pta_url(topology_st):
""" Test dsconf add a PTA URL
:id: 38c7331c-b828-4671-a39f-4f57d1742178
:setup: Standalone instance
:steps:
1. Try to add new PTA URL
2. Check if new PTA URL is added.
:expectedresults:
1. Success
2. Success
"""

args = FakeArgs()
args.URL = new_url

log.info("Add new URL.")
pta_add(topology_st.standalone, DEFAULT_SUFFIX, topology_st.logcap.log, args)
check_value_in_log_and_reset(topology_st, check_value="Command successful.")


if __name__ == '__main__':
# Run isolated
# -s for DEBUG mode
CURRENT_FILE = os.path.realpath(__file__)
pytest.main(["-s", CURRENT_FILE])
1 change: 1 addition & 0 deletions src/lib389/lib389/cli_conf/plugins/ldappassthrough.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def pta_add(inst, basedn, log, args):
if new_url_l in urls:
raise ldap.ALREADY_EXISTS("Entry %s already exists" % args.URL)
plugin.add("nsslapd-pluginarg%s" % next_num, args.URL)
log.info("Command successful.")


def pta_edit(inst, basedn, log, args):
Expand Down

0 comments on commit a9a1db2

Please sign in to comment.