Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test ldap #13978

Merged
merged 4 commits into from
Nov 30, 2023
Merged

Test ldap #13978

merged 4 commits into from
Nov 30, 2023

Conversation

uberbrady
Copy link
Collaborator

This adds a test suite for our LDAP implementation. The only way I was able to make it make sense to me was to add a special Mocking library that allows me to 'stub out' the actual LDAP calls. It's not particularly pretty, but it's at least a decent start to being able to be more confident about changes we make in the LDAP subsystem. There's also more work to do here, in that this doesn't carefully check the various values to ensure that they're all what we would expect. But, again, it's at least a decent start, that we can continue to beef up over time so we can be more confident about making bigger changes to the LDAP subsystem.

@probot-autolabeler probot-autolabeler bot added backend dependencies Pull requests that update a dependency file ldap tests labels Nov 30, 2023
Copy link

what-the-diff bot commented Nov 30, 2023

PR Summary

  • LDAP Support Suggestion
    The PR has included a suggestion for LDAP support within the composer.json file. This indicates a preference for including ext-ldap in the project dependencies.

  • Adjustable LDAP Settings
    Three functional updates have been added to the Settings.php file. These adjustments allow the application to modify its LDAP settings with the methods enableLdap(), enableAnonymousLdap(), and enableBadPasswordLdap().

  • Introduction of LDAP Testing
    A new file titled LdapTest.php has been introduced, offering several test cases for the Ldap class, enhancing the project's robustness and functionality:

    • connect(): Checks if the connection to LDAP is established correctly.
    • bindAdmin(), bindBad(), anonymousBind(), badAnonymousBind(): Tests if the admin can bind to LDAP appropriately, even under erroneous conditions.
    • badEncryptedPassword(): Ensures that an exception is thrown for improperly encrypted passwords.
    • findAndBind(), findAndBindBadPassword(), findAndBindCannotFindSelf(): Validates that the LDAP user can be found and bind successfully. Also ascertains that exceptions are thrown when the search function fails or the admin bind doesn't succeed.
    • findLdapUsers(), findLdapUsersPaginated(): Monitors if the found LDAP users are correct and tests pagination in this context.

Overall, this PR strengthens the project's LDAP support, ensures that settings can be modified, and verifies functionality through thorough test coverage.

@snipe snipe merged commit 5730518 into snipe:develop Nov 30, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend dependencies Pull requests that update a dependency file ldap tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants