Ticket #687: trac#687-test_redirect.diff

File trac#687-test_redirect.diff, 781 bytes (added by Ben Sturmfels, 10 years ago)

Add test for redirect with location.

  • new file mediagoblin/tests/test_response.py

    diff --git a/mediagoblin/tests/test_response.py b/mediagoblin/tests/test_response.py
    new file mode 100644
    index 0000000..13b4895
    - +  
     1import mock
     2from werkzeug.wrappers import Request
     4from mediagoblin.tools.response import redirect
     7def test_redirect_with_location_uses_location(werkzeug_redirect):
     8    """Test that redirect repects the location argument."""
     10    # The fact that we're having to mock werkzeug.utils.redirect suggest that it
     11    # may help to refactor tools.redirect to make it easier to test.
     12    request = Request({})
     13    redirect(request, location='http://www.example.com')
     14    werkzeug_redirect.assert_called_with('http://www.example.com')