Skip to content

Commit

Permalink
chore: added test
Browse files Browse the repository at this point in the history
  • Loading branch information
andruten committed Oct 18, 2024
1 parent 6624d79 commit 2fda99e
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from unittest.mock import patch

from django.conf import settings
from django.test import TestCase, RequestFactory
from django.test import TestCase, RequestFactory, override_settings
try:
from django.utils.six.moves.urllib.parse import ParseResult
except ImportError:
Expand Down Expand Up @@ -194,7 +194,7 @@ class CustomProxyView(ProxyView):
decode_content=False,
headers=headers)

def test_space_is_escaped(self):
def test_space_is_escaped_enabled(self):
class CustomProxyView(ProxyView):
upstream = 'http://example.com'

Expand All @@ -212,6 +212,25 @@ class CustomProxyView(ProxyView):
decode_content=False,
headers=headers)

@override_settings(QUOTE_SPACES_AS_PLUS=False)
def test_space_is_escaped_disabled(self):
class CustomProxyView(ProxyView):
upstream = 'http://example.com'

path = ' test test'
request = self.factory.get(path)
CustomProxyView.as_view()(request, path)

url = 'http://example.com/%20test%20test'
headers = {u'Cookie': u''}
self.urlopen.assert_called_with('GET', url,
body=b'',
redirect=False,
retries=None,
preload_content=False,
decode_content=False,
headers=headers)

def test_extending_headers(self):
class CustomProxyView(ProxyView):
upstream = 'http://example.com'
Expand Down

0 comments on commit 2fda99e

Please sign in to comment.