I am Cc this to testing-in-python mailing list. Hope this makes sense.
Suppose I have a function called "render_reverse" which takes two
arguments: function name, and args list, and it returns "reverse(f, *args)"
If I called render_reverse('happy_birthday', {'args': [username]}), I would
get this: /greeting/birthday/username/
I am going to patch the `reverse` function that's local to render_reverse,
and inside the test, should I always provide a return value like this?
with patch('myproject.myapps.mylibrary.reverse') as mock_reverse:
mock_f = MagicMock(name='f')
mock_kwargs = MagicMock(name='kwargs')
mock_reverse.return_value = ' /greeting/birthday/johnsmith/'
response = mock_reverse(mock_f, mock_kwargs)
self.assert......
What is the best practice in general? How do I determine whether I want to
provide a return value or not? In almost any cases, how do I know things go
well? Sometimes I can't differentiate unittest from integration / system
test (I want to see other codes ikn the same function execute and throw
back the right result!!!!)
Thanks!
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/4QJSDMT5qLoJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.