Code review comment for lp:~fwereade/pyjuju/cobbler-connect-production

Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

[3]

Try taking the commented lines out and run test_bootstrap.

[5]

Not entirely. It is possible to do good unit testing without mocking, but I agree
that in some cases good unit testing moves toward the integration side of things,
and that sounds quite alright in most cases.

The test should be as unity as possible before it starts to get fake and invasive.
Mocking is silly in the sense that it forces you to repeat the same logic twice
(e.g. call foo() in the test, and call foo() in the code), giving a false sense
of confidence in the logic. The outcome is something that does not guarantee
correctness, because you were worried about "how-to" when you wrote the test rather
than the outcome, and that very fact binds the implementation to the test in a
tight way that makes it hard to refactor, as you noticed by counter example.

« Back to merge proposal