Hi Mike,

you can use the mock[1] library for this.

[1]: http://www.voidspace.org.uk/python/mock/


On Fri, May 3, 2013 at 11:09 AM, Mike <mike.t...@gmail.com> wrote:

> I'm starting to write tests for my Django project but I'm not sure how to
> test a function that calls out to a web API.  I read somewhere that I
> should not test against the live web api and that I should develop some
> sort of replacement for the actual web api server which sounds like a lot
> of work.  I was thinking of factoring out the actual api request into its
> own function with as few lines of code as possible and just not test it.
>  Or, perhaps develop some tests that do actually require requests out the
> web api but only run those tests on rare occasions, like just before a
> release for example.  What do other people do?
>
> --
> 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 django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to