Tuesday, June 21, 2011

Re: Unit-Testing Dilemma

On 2011-06-20, at 12:52 PM, Nan wrote:

> I'm not testing the third-party service. I need to test *what I send
> to them*.

Use Mock and assert_called_with:

http://www.voidspace.org.uk/python/mock/mock.html#mock.Mock.assert_called_with

In this case you'd set theAPI.call as your mock and check that under different conditions it is called correctly.
--
Andy McKay
andy@clearwind.ca
twitter: @andymckay

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment