| OLD | NEW |
| 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 json | 8 import json |
| 9 import logging | 9 import logging |
| 10 import os | 10 import os |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 task_queue_urls = sorted( | 329 task_queue_urls = sorted( |
| 330 r for r in self._GetRoutes() if r.startswith('/internal/taskqueue/') | 330 r for r in self._GetRoutes() if r.startswith('/internal/taskqueue/') |
| 331 if not r.startswith('/internal/taskqueue/mapreduce/launch/') | 331 if not r.startswith('/internal/taskqueue/mapreduce/launch/') |
| 332 ) | 332 ) |
| 333 # Format: (<queue-name>, <base-url>, <argument>). | 333 # Format: (<queue-name>, <base-url>, <argument>). |
| 334 task_queues = [ | 334 task_queues = [ |
| 335 ('cancel-tasks', '/internal/taskqueue/cancel-tasks', ''), | 335 ('cancel-tasks', '/internal/taskqueue/cancel-tasks', ''), |
| 336 ('machine-provider-manage', | 336 ('machine-provider-manage', |
| 337 '/internal/taskqueue/machine-provider-manage', ''), | 337 '/internal/taskqueue/machine-provider-manage', ''), |
| 338 ('pubsub', '/internal/taskqueue/pubsub/', 'abcabcabc'), | 338 ('pubsub', '/internal/taskqueue/pubsub/', 'abcabcabc'), |
| 339 ('task-dimensions', '/internal/taskqueue/task-dimensions', ''), |
| 339 ('tsmon', '/internal/taskqueue/tsmon/', 'executors'), | 340 ('tsmon', '/internal/taskqueue/tsmon/', 'executors'), |
| 340 ] | 341 ] |
| 341 self.assertEqual(len(task_queues), len(task_queue_urls)) | 342 self.assertEqual(len(task_queues), len(task_queue_urls)) |
| 342 for i, url in enumerate(task_queue_urls): | 343 for i, url in enumerate(task_queue_urls): |
| 343 self.assertTrue( | 344 self.assertTrue( |
| 344 url.startswith(task_queues[i][1]), | 345 url.startswith(task_queues[i][1]), |
| 345 '%s does not start with %s' % (url, task_queues[i][1])) | 346 '%s does not start with %s' % (url, task_queues[i][1])) |
| 346 | 347 |
| 347 for _, url, arg in task_queues: | 348 for _, url, arg in task_queues: |
| 348 self.app.post( | 349 self.app.post( |
| 349 url+arg, headers={'X-AppEngine-QueueName': 'bogus name'}, status=403) | 350 url+arg, headers={'X-AppEngine-QueueName': 'bogus name'}, status=403) |
| 350 | 351 |
| 351 | 352 |
| 352 if __name__ == '__main__': | 353 if __name__ == '__main__': |
| 353 if '-v' in sys.argv: | 354 if '-v' in sys.argv: |
| 354 unittest.TestCase.maxDiff = None | 355 unittest.TestCase.maxDiff = None |
| 355 logging.basicConfig( | 356 logging.basicConfig( |
| 356 level=logging.DEBUG if '-v' in sys.argv else logging.CRITICAL, | 357 level=logging.DEBUG if '-v' in sys.argv else logging.CRITICAL, |
| 357 format='%(levelname)-7s %(filename)s:%(lineno)3d %(message)s') | 358 format='%(levelname)-7s %(filename)s:%(lineno)3d %(message)s') |
| 358 unittest.main() | 359 unittest.main() |
| OLD | NEW |