Skip to content

Fix error reporting of LDAPObject.set_option() - #101

Merged
encukou merged 2 commits into
python-ldap:masterfrom
tiran:ldapobject_set_option
Dec 5, 2017
Merged

encukou merged 2 commits into
python-ldap:masterfrom
tiran:ldapobject_set_option

Conversation

@tiran

@tiran tiran commented Dec 5, 2017

Copy link
Copy Markdown
Member

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 cheimes@redhat.com

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 <cheimes@redhat.com>
@codecov

codecov Bot commented Dec 5, 2017

Copy link
Copy Markdown

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

encukou commented Dec 5, 2017

Copy link
Copy Markdown
Member

Nice, thanks!

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

@tiran

tiran commented Dec 5, 2017

Copy link
Copy Markdown
Member Author

@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