URL:
https://github.com/SSSD/sssd/pull/464
Title: #464: SYSDB: Properly handle name/gid override when using domain resolution order
lslebodn commented:
"""
On (08/12/17 16:53), fidencio wrote:
Sure thing. I'd appreciate some guidance on how to write a valid
test for this case, considering it involves an AD-IPA trust setup.
Unit test cover execution of function and therefore does not require any
"AD-IPA trust setup". Unit test != integration test.
You pass some arguments to function and expect some result.
+fail if expected result is different.
Unit testing sometimes requires preparing mock object. It is a simulated
objects that mimic the behavior of real objects in controlled ways[1]
It is a huge benefit because sometimes it is complicated to reproduce some
state with integration tests.
There is lot of resources on net about unit testing[2,3,4]
And we have quite hight code coverage in sysdb (73.8 % of functions)
BTW the function `sysdb_getgrgid` is already used in more than one unit test
test_nested_groups.c, test_sysdb_ts_cache, sysdb-tests.c.
LS
[1]
https://en.wikipedia.org/wiki/Mock_object
[2]
https://en.wikipedia.org/wiki/Unit_testing
[3]
https://www.youtube.com/watch?time_continue=3&v=wEhu57pih5w
[4]
http://softwaretestingfundamentals.com/unit-testing/
"""
See the full comment at
https://github.com/SSSD/sssd/pull/464#issuecomment-350441705