Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix error reporting of LDAPObject.set_option() #101

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

Merged
merged 2 commits into from
Dec 5, 2017

Conversation

tiran
Copy link
Member

@tiran tiran commented Dec 5, 2017

The method LDAPObject.set_option() did not signal an exception in case
the set option failed. The bug was caused by checking for the wrong
error value. The internal C function LDAP_set_option() returns 1 for
sucess and 0 for error, but LDAPObject.set_option() was checking for
-1.

Add some tests for LDAPObject.set_option() and LDAPObject.get_option().

Closes: #100
Signed-off-by: Christian Heimes [email protected]

The method LDAPObject.set_option() did not signal an exception in case
the set option failed. The bug was caused by checking for the wrong
error value. The internal C function LDAP_set_option() returns ``1`` for
sucess and ``0`` for error, but LDAPObject.set_option() was checking for
``-1``.

Add some tests for LDAPObject.set_option() and LDAPObject.get_option().

Closes: python-ldap#100
Signed-off-by: Christian Heimes <[email protected]>
@codecov
Copy link

codecov bot commented Dec 5, 2017

Codecov Report

Merging #101 into master will increase coverage by 0.32%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master     #101      +/-   ##
==========================================
+ Coverage   67.72%   68.04%   +0.32%     
==========================================
  Files          48       48              
  Lines        4676     4676              
  Branches      785      785              
==========================================
+ Hits         3167     3182      +15     
+ Misses       1151     1143       -8     
+ Partials      358      351       -7
Impacted Files Coverage Δ
Modules/LDAPObject.c 67.7% <100%> (+0.29%) ⬆️
Lib/ldap/ldapobject.py 66.31% <0%> (+1.27%) ⬆️
Modules/options.c 79.48% <0%> (+5.98%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c4bcf1d...33fc102. Read the comment docs.

Make TestGlobalOptions and TestLDAPObjectOptions peers in the
inheritance hierarchy, rather than one deriving from the other.
@encukou
Copy link
Member

encukou commented Dec 5, 2017

Nice, thanks!

Just yesterday I was teaching beginners about the perils of subclassing, so I couldn't resist fixing the inheritance a bit.

@tiran
Copy link
Member Author

tiran commented Dec 5, 2017

@encukou +1

I'll use the enhancements to implement test for #95 later.

@encukou encukou merged commit eb9dbc1 into python-ldap:master Dec 5, 2017
@tiran tiran deleted the ldapobject_set_option branch December 5, 2017 14:33
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.

2 participants