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

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

Issue 2410573002: Make new UI be the default UI (Closed)
Patch Set: simplify regex Created 4 years, 2 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/swarming/handlers_frontend.py ('k') | appengine/swarming/ui/build/elements.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 # coding: utf-8 2 # coding: utf-8
3 # Copyright 2013 The LUCI Authors. All rights reserved. 3 # Copyright 2013 The LUCI Authors. All rights reserved.
4 # Use of this source code is governed under the Apache License, Version 2.0 4 # Use of this source code is governed under the Apache License, Version 2.0
5 # that can be found in the LICENSE file. 5 # that can be found in the LICENSE file.
6 6
7 import datetime 7 import datetime
8 import itertools 8 import itertools
9 import json 9 import json
10 import logging 10 import logging
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 '/restricted/bot/id1/delete', 87 '/restricted/bot/id1/delete',
88 params={}, 88 params={},
89 headers={'X-XSRF-Token': self.get_xsrf_token()}) 89 headers={'X-XSRF-Token': self.get_xsrf_token()})
90 self.assertFalse('id1' in response.body) 90 self.assertFalse('id1' in response.body)
91 91
92 response = self.app.get('/restricted/bots', status=200) 92 response = self.app.get('/restricted/bots', status=200)
93 self.assertFalse('id1' in response.body) 93 self.assertFalse('id1' in response.body)
94 94
95 def test_root(self): 95 def test_root(self):
96 response = self.app.get('/', status=200) 96 response = self.app.get('/', status=200)
97 self.assertGreater(len(response.body), 1000) 97 self.assertGreater(len(response.body), 600)
98 98
99 def testAllSwarmingHandlersAreSecured(self): 99 def testAllSwarmingHandlersAreSecured(self):
100 # Test that all handlers are accessible only to authenticated user or 100 # Test that all handlers are accessible only to authenticated user or
101 # bots. Assumes all routes are defined with plain paths (i.e. 101 # bots. Assumes all routes are defined with plain paths (i.e.
102 # '/some/handler/path' and not regexps). 102 # '/some/handler/path' and not regexps).
103 103
104 # URL prefixes that correspond to routes that are not protected by swarming 104 # URL prefixes that correspond to routes that are not protected by swarming
105 # app code. It may be routes that do not require login or routes protected 105 # app code. It may be routes that do not require login or routes protected
106 # by GAE itself via 'login: admin' in app.yaml. 106 # by GAE itself via 'login: admin' in app.yaml.
107 using_app_login_prefixes = ( 107 using_app_login_prefixes = (
108 '/auth/', 108 '/auth/',
109 ) 109 )
110 110
111 public_urls = frozenset([ 111 public_urls = frozenset([
112 '/', 112 '/',
113 '/oldui',
113 '/_ah/warmup', 114 '/_ah/warmup',
114 '/api/config/v1/validate', 115 '/api/config/v1/validate',
115 '/auth', 116 '/auth',
116 '/ereporter2/api/v1/on_error', 117 '/ereporter2/api/v1/on_error',
117 '/stats', 118 '/stats',
118 '/api/swarming/v1/server/permissions', 119 '/api/swarming/v1/server/permissions',
119 '/swarming/api/v1/client/list', 120 '/swarming/api/v1/client/list',
120 '/swarming/api/v1/bot/server_ping', 121 '/swarming/api/v1/bot/server_ping',
121 '/swarming/api/v1/stats/summary/<resolution:[a-z]+>', 122 '/swarming/api/v1/stats/summary/<resolution:[a-z]+>',
122 '/swarming/api/v1/stats/dimensions/<dimensions:.+>/<resolution:[a-z]+>', 123 '/swarming/api/v1/stats/dimensions/<dimensions:.+>/<resolution:[a-z]+>',
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 url, headers={'X-AppEngine-QueueName': 'bogus name'}, status=403) 563 url, headers={'X-AppEngine-QueueName': 'bogus name'}, status=403)
563 564
564 565
565 if __name__ == '__main__': 566 if __name__ == '__main__':
566 if '-v' in sys.argv: 567 if '-v' in sys.argv:
567 unittest.TestCase.maxDiff = None 568 unittest.TestCase.maxDiff = None
568 logging.basicConfig( 569 logging.basicConfig(
569 level=logging.DEBUG if '-v' in sys.argv else logging.CRITICAL, 570 level=logging.DEBUG if '-v' in sys.argv else logging.CRITICAL,
570 format='%(levelname)-7s %(filename)s:%(lineno)3d %(message)s') 571 format='%(levelname)-7s %(filename)s:%(lineno)3d %(message)s')
571 unittest.main() 572 unittest.main()
OLDNEW
« no previous file with comments | « appengine/swarming/handlers_frontend.py ('k') | appengine/swarming/ui/build/elements.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698