Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(727)

Side by Side Diff: appengine/isolate/handlers_test.py

Issue 2693953006: Isolate: Download files as their filename instead of hash (Closed)
Patch Set: Isolate: Download files as their filename instead of hash Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « appengine/isolate/handlers_frontend.py ('k') | appengine/isolate/templates/browse.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2013 The LUCI Authors. All rights reserved. 2 # Copyright 2013 The LUCI Authors. All rights reserved.
3 # Use of this source code is governed under the Apache License, Version 2.0 3 # Use of this source code is governed under the Apache License, Version 2.0
4 # that can be found in the LICENSE file. 4 # that can be found in the LICENSE file.
5 5
6 import datetime 6 import datetime
7 import hashlib 7 import hashlib
8 import logging 8 import logging
9 import os 9 import os
10 import sys 10 import sys
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 return resp['xsrf_token'].encode('ascii') 145 return resp['xsrf_token'].encode('ascii')
146 146
147 def test_root(self): 147 def test_root(self):
148 # Just asserts it doesn't crash. 148 # Just asserts it doesn't crash.
149 self.app_frontend.get('/') 149 self.app_frontend.get('/')
150 150
151 def test_browse(self): 151 def test_browse(self):
152 self.set_as_reader() 152 self.set_as_reader()
153 hashhex = self.gen_content() 153 hashhex = self.gen_content()
154 self.app_frontend.get('/browse?namespace=default&hash=%s' % hashhex) 154 self.app_frontend.get('/browse?namespace=default&hash=%s' % hashhex)
155 self.app_frontend.get(
156 '/browse?namespace=default&hash=%s&as=file1.txt' % hashhex)
155 157
156 def test_browse_missing(self): 158 def test_browse_missing(self):
157 self.set_as_reader() 159 self.set_as_reader()
158 hashhex = '0123456780123456780123456789990123456789' 160 hashhex = '0123456780123456780123456789990123456789'
159 self.app_frontend.get( 161 self.app_frontend.get(
160 '/browse?namespace=default&hash=%s' % hashhex, status=404) 162 '/browse?namespace=default&digest=%s' % hashhex, status=404)
163
164 def test_content(self):
165 self.set_as_reader()
166 hashhex = self.gen_content()
167 self.app_frontend.get('/content?namespace=default-gzip&hash=%s' % hashhex)
168 self.app_frontend.get(
169 '/content?namespace=default-gzip&hash=%s&as=file1.txt' % hashhex)
161 170
162 def test_config(self): 171 def test_config(self):
163 self.set_as_admin() 172 self.set_as_admin()
164 resp = self.app_frontend.get('/restricted/config') 173 resp = self.app_frontend.get('/restricted/config')
165 # TODO(maruel): Use beautifulsoup? 174 # TODO(maruel): Use beautifulsoup?
166 priv_key = 'test private key' 175 priv_key = 'test private key'
167 params = { 176 params = {
168 'gs_private_key': priv_key, 177 'gs_private_key': priv_key,
169 'keyid': str(config.settings_info()['cfg'].key.integer_id()), 178 'keyid': str(config.settings_info()['cfg'].key.integer_id()),
170 'xsrf_token': self.get_xsrf_token(), 179 'xsrf_token': self.get_xsrf_token(),
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 self.assertEqual(expected, response.body) 263 self.assertEqual(expected, response.body)
255 264
256 265
257 if __name__ == '__main__': 266 if __name__ == '__main__':
258 if '-v' in sys.argv: 267 if '-v' in sys.argv:
259 unittest.TestCase.maxDiff = None 268 unittest.TestCase.maxDiff = None
260 logging.basicConfig(level=logging.DEBUG) 269 logging.basicConfig(level=logging.DEBUG)
261 else: 270 else:
262 logging.basicConfig(level=logging.FATAL) 271 logging.basicConfig(level=logging.FATAL)
263 unittest.main() 272 unittest.main()
OLDNEW
« no previous file with comments | « appengine/isolate/handlers_frontend.py ('k') | appengine/isolate/templates/browse.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698