| 1 |
# --- BEGIN COPYRIGHT BLOCK --- |
| 2 |
# Copyright (C) 2023 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 |
import os |
| 11 |
import logging |
| 12 |
|
| 13 |
from test389.topologies import topology_st |
| 14 |
from lib389.cli_conf.plugins.ldappassthrough import pta_add |
| 15 |
from lib389._constants import DEFAULT_SUFFIX |
| 16 |
from lib389.cli_base import FakeArgs |
| 17 |
from . import check_value_in_log_and_reset |
| 18 |
|
| 19 |
logging.getLogger(__name__).setLevel(logging.DEBUG) |
| 20 |
log = logging.getLogger(__name__) |
| 21 |
new_url = "ldap://localhost:7389/o=redhat" |
| 22 |
|
| 23 |
|
| 24 |
def test_dsconf_add_pta_url(topology_st): |
| 25 |
""" Test dsconf add a PTA URL |
| 26 |
|
| 27 |
:id: 38c7331c-b828-4671-a39f-4f57d1742178 |
| 28 |
:setup: Standalone instance |
| 29 |
:steps: |
| 30 |
1. Try to add new PTA URL |
| 31 |
2. Check if new PTA URL is added. |
| 32 |
:expectedresults: |
| 33 |
1. Success |
| 34 |
2. Success |
| 35 |
""" |
| 36 |
|
| 37 |
args = FakeArgs() |
| 38 |
args.URL = new_url |
| 39 |
|
| 40 |
log.info("Add new URL.") |
| 41 |
pta_add(topology_st.standalone, DEFAULT_SUFFIX, topology_st.logcap.log, args) |
| 42 |
check_value_in_log_and_reset(topology_st, check_value="Successfully added URL") |
| 43 |
|
| 44 |
|
| 45 |
if __name__ == '__main__': |
| 46 |
# Run isolated |
| 47 |
# -s for DEBUG mode |
| 48 |
CURRENT_FILE = os.path.realpath(__file__) |
| 49 |
pytest.main(["-s", CURRENT_FILE]) |