[389-devel] Proof of concept: mocking DS in lib389

Roberto Polli rpolli at babel.it
Mon Oct 28 13:52:45 UTC 2013


Hi @all,

Jan wrote:
> >>> as I promised, I am sending you a proof-of-concept code that
> >>> demonstrates, how we can mock DS in unit tests for library function
Ok, that's clear.

> >>> instead of sending command to real DS instance,
> >>> they just store the data in 'dit' dictionary
We could use some monkeypatching lib. 
https://pypi.python.org/pypi/fakeldap/0.5.1

> >>> Now I can successfully test that enable_changelog really works,
_really_ is not the right word, right :DDDD

> >>> this approach would work for 95% of all functions in lib389.
I agree that many functions are just ADD/DELETE, and this will work for that.

Mocking functions involving MOD, default values, simulating errors & co will 
be complex though: that's the reason why - even after adding unit tests - I 
will leave the integration testings in the same repo.

> >>> DSInstance. That is handled by DSModuleProxy. We already went through
> >>> this, but not with Roberto.
Saw the code, it just imports all files in the folder, right? It's a nice 
trick, even if it makes the design a bit complex.

Peace,
R.


-- 
Roberto Polli
Community Manager
Babel S.r.l. - http://www.babel.it
T: +39.06.9826.9651 M: +39.340.652.2736 F: +39.06.9826.9680
P.zza S.Benedetto da Norcia, 33 - 00040 Pomezia (Roma)

CONFIDENZIALE: Questo messaggio ed i suoi allegati sono di carattere 
confidenziale per i destinatari in indirizzo.
E' vietato l'inoltro non autorizzato a destinatari diversi da quelli indicati 
nel messaggio originale.
Se ricevuto per errore, l'uso del contenuto e' proibito; si prega di 
comunicarlo al mittente e cancellarlo immediatamente.


More information about the 389-devel mailing list