aboutsummaryrefslogtreecommitdiff
path: root/license_protected_downloads/tests/test_views.py
diff options
context:
space:
mode:
authorAndy Doan <andy.doan@linaro.org>2015-07-30 11:56:48 -0500
committerAndy Doan <andy.doan@linaro.org>2015-07-30 11:56:48 -0500
commit65cd78e65b1bfb7836f170bc3b4af58a02a5b075 (patch)
treec6d139d0d9bb4a447d49a7700d2d5d9875df826a /license_protected_downloads/tests/test_views.py
parent0255455978152e6bb1b4b024a8683cc66f05f910 (diff)
bug #1729: handle directory listings in a normal manner
The code base has always tried to handle a directory listing using the same logic whether or not it included a trailing slash. This leads to issues when people want to construct textile files that require relative URLs. There are 2 parts to this "fix": 1) start including the trailing slash when we generate our directory listings. 2) perform a redirect if we are given a directory and don't have the trailing slash. Change-Id: I48c91ab9e9f1a72a3723fa4c84917db772b7215c
Diffstat (limited to 'license_protected_downloads/tests/test_views.py')
-rw-r--r--license_protected_downloads/tests/test_views.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/license_protected_downloads/tests/test_views.py b/license_protected_downloads/tests/test_views.py
index 8bbe01a..c635609 100644
--- a/license_protected_downloads/tests/test_views.py
+++ b/license_protected_downloads/tests/test_views.py
@@ -346,6 +346,13 @@ class ViewTests(BaseServeViewTest):
r'<th></th><th>Name</th><th>Last modified</th>'
'<th>Size</th><th style="display: None">License</th>')
+ def test_dir_redirect(self):
+ '''URLs to directs without trailing / should result in a redirect'''
+ url = 'http://testserver/~linaro-android'
+ response = self.client.get(url)
+ self.assertEqual(302, response.status_code)
+ self.assertEqual(url + '/', response['Location'])
+
def test_not_found_file(self):
target_file = "12qwaszx"
url = urlparse.urljoin("http://testserver/", target_file)