It seems correct, but the question is if you should do it.

In my opinion you shouldn't, you should set the test data and make a real
query then compare results, you shouldn't care how the function got the
data, but that it got it correctly.

let's say tomorrow you add a prefetch_related to your query, you're still
getting the same data, but now your tests are failing because you are doing
it differently

On Thu, Apr 30, 2015 at 10:25 PM, Edgar Gabaldi <[email protected]> wrote:

> Who practices TDD (XP like) says that the tests need to run quickly. For
> this, we have to mock all external resources of the method that i want to
> test.
>
> In the case of queryset, i think so strange. Eg:
> https://gist.github.com/edgabaldi/ffdffa60f2add650f052
>
> Am i doing it wrong? Do i have better way to do that?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAGjPPHkvcPGusgTzddJ3SVtfeGhgQCZb4L9tOq8vWgY9OoP8zQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAGjPPHkvcPGusgTzddJ3SVtfeGhgQCZb4L9tOq8vWgY9OoP8zQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFWa6tLO-cr8g%3Df%2B%2BsntHr%2BHZpqbd%3DdtJWarfEeNEJEom-qqJA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to