BaseDownloadViewTestCase: render_to_response mock is now called with args and kwargs

Updated BaseDownloadViewTestCase to not use dummy args/kwargs but kwargs which BaseDownloadView.get() actually forwards to DownloadResponse.__init__().
This commit is contained in:
René Leonhardt 2015-08-03 15:49:56 +02:00
parent fb645ce27a
commit 8b8ef8bd28

View file

@ -221,14 +221,14 @@ class BaseDownloadViewTestCase(unittest.TestCase):
def test_get(self):
"""BaseDownloadView.get() calls render_to_response()."""
request = django.test.RequestFactory().get('/dummy-url')
args = ['dummy-arg']
kwargs = {'dummy': 'kwarg'}
args = []
kwargs = {'content_type': 'application/pdf'}
view = setup_view(views.BaseDownloadView(), request, *args, **kwargs)
view.render_to_response = mock.Mock(
return_value=mock.sentinel.response)
response = view.get(request, *args, **kwargs)
self.assertIs(response, mock.sentinel.response)
view.render_to_response.assert_called_once_with()
view.render_to_response.assert_called_once_with(*args, **kwargs)
class PathDownloadViewTestCase(unittest.TestCase):