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

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

Issue 2693953006: Isolate: Download files as their filename instead of hash (Closed)
Patch Set: Created 3 years, 10 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
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 params = { 175 params = {
167 'default_expiration': 123456, 176 'default_expiration': 123456,
168 'google_analytics': 'foobar', 177 'google_analytics': 'foobar',
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 self.assertEqual(expected, response.body) 264 self.assertEqual(expected, response.body)
256 265
257 266
258 if __name__ == '__main__': 267 if __name__ == '__main__':
259 if '-v' in sys.argv: 268 if '-v' in sys.argv:
260 unittest.TestCase.maxDiff = None 269 unittest.TestCase.maxDiff = None
261 logging.basicConfig(level=logging.DEBUG) 270 logging.basicConfig(level=logging.DEBUG)
262 else: 271 else:
263 logging.basicConfig(level=logging.FATAL) 272 logging.basicConfig(level=logging.FATAL)
264 unittest.main() 273 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698