Skip to content

User LDAP#17

Merged
matejak merged 1 commit intoEnterpriseyIntranet:masterfrom
danil-topchiy:user_ldap
Jan 16, 2019
Merged

User LDAP#17
matejak merged 1 commit intoEnterpriseyIntranet:masterfrom
danil-topchiy:user_ldap

Conversation

@danil-topchiy
Copy link

Add class for User LDAP api, tests

res = self.nxc.edit_ldap_config(config_id, data={param_to_change: new_param_value})
assert res['ocs']['meta']['statuscode'] == self.SUCCESS_CODE
new_config_data = self.nxc.get_ldap_config(config_id)['ocs']['data']
assert str(new_config_data[param_to_change]) == str(new_param_value)
Copy link

Choose a reason for hiding this comment

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

That's interesting, what is the point of the conversion? You treat new_config_data[param_to_change] as integer earlier in the test.

Copy link
Author

Choose a reason for hiding this comment

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

You right, didn't notice that at first it was integer.
After request it set ldapPagingSize as string, even though I sent integer there. Looks like it happens because of x-www-form-urlencoded Content-type which is required.

(Pdb) config_data[param_to_change]
500
(Pdb) new_param_value
777
(Pdb) new_config_data[param_to_change]
'777'

return self.requester.post(url)


class UserLDAP(WithRequester):
Copy link

Choose a reason for hiding this comment

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

It would be great to provide methods for configuration s.a. edit_ldap_password and get_ldap_password instead of the edit_ldap_config accepting a opcode argument. It is possible to go the manual way of reading the documentation and creating those methods by hand, or if they are very similar, it may be worth considering to define a list of e.g. (name_stem, argname, docstring) tuples in the module, and creating those methods dynamically in the class constructor using setattr.
Think about that, it is not a requirement for this PR to be merged, it can be added later.

Copy link
Author

Choose a reason for hiding this comment

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

Great idea, thanks! I've added it as a TODO comment below to refactor it like this later.

@matejak matejak added this to the 0.1 milestone Jan 14, 2019
@matejak matejak added the enhancement New feature or request label Jan 14, 2019
@matejak
Copy link

matejak commented Jan 14, 2019

Please rebase. I have some questions and suggestion, but nothing that could be called a merge blocker.

@danil-topchiy danil-topchiy force-pushed the user_ldap branch 2 times, most recently from 56e3eba to 6df7799 Compare January 14, 2019 22:30
@danil-topchiy
Copy link
Author

Rebased it

@matejak matejak mentioned this pull request Jan 15, 2019
@matejak
Copy link

matejak commented Jan 15, 2019

Great, merging. I have added some of the discussion notes to the issue #4.

Oops, here goes that conflict again. Please rebase this one, I will merge #14 later, after you rebase it after merge of this PR.

@danil-topchiy
Copy link
Author

danil-topchiy commented Jan 15, 2019

Rebased. Checked notes at #4 issue, agree, will start doing refactoring in separate branch when will have all the current features merged.

@scrutinizer-notifier
Copy link

The inspection completed: 4 new issues, 7 updated code elements

@danil-topchiy danil-topchiy mentioned this pull request Jan 15, 2019
@matejak
Copy link

matejak commented Jan 16, 2019

Sure, agree!

@matejak matejak merged commit 60635b6 into EnterpriseyIntranet:master Jan 16, 2019
@danil-topchiy danil-topchiy deleted the user_ldap branch January 16, 2019 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants