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

2013-10-29 Thread Jan Rusnacko
Hello Thierry, I am not rewriting ldapadd,... methods of real DS class, I am in fact creating MockDS class with custom ldapadd,... methods, _just_ like you suggest :) Furthermore, you can view it as a subclass of real_ds - even though it is not a proper Python subclass, it inherits all

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

2013-10-29 Thread Jan Rusnacko
On 10/28/2013 02:52 PM, Roberto Polli wrote: 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

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

2013-10-29 Thread Jan Rusnacko
On 10/29/2013 03:30 PM, thierry bordaz wrote: On 10/29/2013 02:18 PM, Jan Rusnacko wrote: Hello Thierry, I am not rewriting ldapadd,... methods of real DS class, I am in fact creating MockDS class with custom ldapadd,... methods, _just_ like you suggest :) Furthermore, you can view it as

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

2013-10-29 Thread thierry bordaz
On 10/29/2013 02:18 PM, Jan Rusnacko wrote: Hello Thierry, I am not rewriting ldapadd,... methods of real DS class, I am in fact creating MockDS class with custom ldapadd,... methods, _just_ like you suggest :) Furthermore, you can view it as a subclass of real_ds - even though it is not a

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

2013-10-29 Thread Jan Rusnacko
On 10/28/2013 02:31 PM, Rich Megginson wrote: On 10/26/2013 12:49 AM, Jan Rusnacko wrote: On 10/25/2013 11:00 PM, Rich Megginson wrote: On 10/25/2013 01:36 PM, Jan Rusnacko wrote: Hello Roberto and Thierry, as I promised, I am sending you a proof-of-concept code that demonstrates, how we

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

2013-10-29 Thread Roberto Polli
Hi @all, Jan wrote: I am in fact creating MockDS class with custom ldapadd, actually I agree with Jan about how the mocking process works: 1- reuse/create an ldap mocking class; 2- rewire existing tests on the mock; Hence, a unit test. Ok, I agree to add unit-testing. Just I don't want to

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

2013-10-28 Thread Rich Megginson
On 10/26/2013 12:49 AM, Jan Rusnacko wrote: On 10/25/2013 11:00 PM, Rich Megginson wrote: On 10/25/2013 01:36 PM, Jan Rusnacko wrote: Hello Roberto and Thierry, 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

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

2013-10-28 Thread Roberto Polli
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

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

2013-10-26 Thread Jan Rusnacko
On 10/25/2013 11:00 PM, Rich Megginson wrote: On 10/25/2013 01:36 PM, Jan Rusnacko wrote: Hello Roberto and Thierry, 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 (see attachment). You can run tests just

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

2013-10-25 Thread Rich Megginson
On 10/25/2013 01:36 PM, Jan Rusnacko wrote: Hello Roberto and Thierry, 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 (see attachment). You can run tests just by executing py.test in tests directory. Only 3 files

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

2013-10-25 Thread Jan Rusnacko
Hello Roberto and Thierry, 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 (see attachment). You can run tests just by executing py.test in tests directory. Only 3 files are of interest here: