Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue 50041 - Add CLI functionality for special plugins
Description: Add the functionality for account-policy, attr-uniq, automember, dna, linked-attr, managed-entries, memberof, pass-through-auth, refer-init, retro-changelog, root-dn, usn commands. Make DSLdapObject create an entry with only DN and attributes (cases when RDN is not specified). Fix two small typos in pwpolicy CLI's arguments. Port test for DNA plugin. https://pagure.io/389-ds-base/issue/50041 Reviewed by: wibrown, mreynolds, mhonek (Thanks!)
- Loading branch information
Showing
30 changed files
with
1,586 additions
and
791 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# --- BEGIN COPYRIGHT BLOCK --- | ||
# Copyright (C) 2019 Red Hat, Inc. | ||
# All rights reserved. | ||
# | ||
# License: GPL (version 3 or any later version). | ||
# See LICENSE for details. | ||
# --- END COPYRIGHT BLOCK --- | ||
# | ||
"""Test DNA plugin functionality""" | ||
|
||
import logging | ||
import pytest | ||
from lib389._constants import DEFAULT_SUFFIX | ||
from lib389.plugins import DNAPlugin, DNAPluginSharedConfigs, DNAPluginConfigs | ||
from lib389.idm.organizationalunit import OrganizationalUnits | ||
from lib389.idm.user import UserAccounts | ||
from lib389.topologies import topology_st | ||
import ldap | ||
|
||
log = logging.getLogger(__name__) | ||
|
||
|
||
@pytest.mark.ds47937 | ||
def test_dnatype_only_valid(topology_st): | ||
"""Test that DNA plugin only accepts valid attributes for "dnaType" | ||
:id: 0878ecff-5fdc-47d7-8c8f-edf4556f9746 | ||
:setup: Standalone Instance | ||
:steps: | ||
1. Create a use entry | ||
2. Create DNA shared config entry container | ||
3. Create DNA shared config entry | ||
4. Add DNA plugin config entry | ||
5. Enable DNA plugin | ||
6. Restart the instance | ||
7. Replace dnaType with invalid value | ||
:expectedresults: | ||
1. Successful | ||
2. Successful | ||
3. Successful | ||
4. Successful | ||
5. Successful | ||
6. Successful | ||
7. Unwilling to perform exception should be raised | ||
""" | ||
|
||
inst = topology_st.standalone | ||
plugin = DNAPlugin(inst) | ||
|
||
log.info("Creating an entry...") | ||
users = UserAccounts(inst, DEFAULT_SUFFIX) | ||
users.create_test_user(uid=1) | ||
|
||
log.info("Creating \"ou=ranges\"...") | ||
ous = OrganizationalUnits(inst, DEFAULT_SUFFIX) | ||
ou_ranges = ous.create(properties={'ou': 'ranges'}) | ||
ou_people = ous.get("People") | ||
|
||
log.info("Creating DNA shared config entry...") | ||
shared_configs = DNAPluginSharedConfigs(inst, ou_ranges.dn) | ||
shared_configs.create(properties={'dnaHostName': str(inst.host), | ||
'dnaPortNum': str(inst.port), | ||
'dnaRemainingValues': '9501'}) | ||
|
||
log.info("Add dna plugin config entry...") | ||
configs = DNAPluginConfigs(inst, plugin.dn) | ||
config = configs.create(properties={'cn': 'dna config', | ||
'dnaType': 'description', | ||
'dnaMaxValue': '10000', | ||
'dnaMagicRegen': '0', | ||
'dnaFilter': '(objectclass=top)', | ||
'dnaScope': ou_people.dn, | ||
'dnaNextValue': '500', | ||
'dnaSharedCfgDN': ou_ranges.dn}) | ||
|
||
log.info("Enable the DNA plugin...") | ||
plugin.enable() | ||
|
||
log.info("Restarting the server...") | ||
inst.restart() | ||
|
||
log.info("Apply an invalid attribute to the DNA config(dnaType: foo)...") | ||
with pytest.raises(ldap.UNWILLING_TO_PERFORM): | ||
config.replace('dnaType', 'foo') |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.