Skip to content

Conversation

@sunweaver
Copy link
Contributor

No description provided.

@timabbott
Copy link
Member

timabbott commented Nov 29, 2020 via email

@sunweaver
Copy link
Contributor Author

@timabbott unit tests have now been added. I also had to pull in the patch from #20 into this PR to make tests work.

 The MockLDAP class's internal recording system of LDAP changes and
 the system for customizing Python LDAP API replies are implemented
 via storing and returning data into/from Python dictionary-like
 entities.

 For putting elements into these entities (namely, MockLDAP.directory,
 MockLDAP.calls and MockLDAP.return_value_map), all presented data
 elements (modlists, dn strings, Python LDAP data structures, etc.) need
 to be hashable.

 However, Python lists and dictionaries are not hashable. Thus, we now
 send every incoming data item into a generically designed _tupelize()
 function.

 By using the new _tupelize() function, we are now able to drop various
 individual tuple() calls on list objects inside the processed data
 elements (thus, we don't need to unwrap these data elements anymore).

 The _tupelize() function works for all basic Python variable types
 (booleans, strings, numbers, tuples, lists and dictionaries).
@sunweaver sunweaver force-pushed the pr/fix-ldapmodify-operations branch from 12e6441 to 1e87c4e Compare November 30, 2020 15:16
@sunweaver sunweaver changed the title Fix ldap.MOD_ADD and ldap.MOD_DELETE operations on multi-value attribute descriptions Fix ldap.MOD_ADD, ldap.MOD_DELETE and ldap.MOD_REPLACE operations on multi-value attribute descriptions Nov 30, 2020
if op is 0:
# FIXME: Can't handle multiple entries with the same name
# its broken right now
# do a MOD_ADD, assume it to be a list of values
Copy link
Collaborator

@mateuszmandera mateuszmandera Jul 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick - Can we leave the piece of the comment saying this is MOD_ADD?

Suggested change
# do a MOD_ADD, assume it to be a list of values
# do a MOD_ADD

Copy link
Collaborator

@mateuszmandera mateuszmandera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These all look like valuable improvements and the implementation looks correct for fakeldap (we're not intending to be covering all the edge cases and accurately mimicking real LDAP behavior for them - and this expands the range of well-handled scenarios), so I think it should be good to merge @timabbott

@sunweaver
Copy link
Contributor Author

sunweaver commented Jul 17, 2021 via email

@timabbott
Copy link
Member

@mateuszmandera feel free to make that tweak and merge (I just made sure you have access; should be easy with our reset-to-pull-request / push-to-pull-request tools).

@mateuszmandera
Copy link
Collaborator

Merged, thanks a lot @sunweaver !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants