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

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

Issue 2012843003: Remove use of search API; effectively remove support to search for task by name. (Closed) Base URL: git@github.com:luci/luci-py.git@master
Patch Set: . Created 4 years, 7 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/server/task_result.py » ('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 itertools 7 import itertools
8 import logging 8 import logging
9 import os 9 import os
10 import re 10 import re
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 url = '/user/tasks?sort=%s&state=%s' % (sort, state) 254 url = '/user/tasks?sort=%s&state=%s' % (sort, state)
255 # See require_index in ../components/support/test_case.py in case of 255 # See require_index in ../components/support/test_case.py in case of
256 # NeedIndexError. Do not use status=200 so the output is printed in case 256 # NeedIndexError. Do not use status=200 so the output is printed in case
257 # of failure. 257 # of failure.
258 resp = self.app.get(url, expect_errors=True) 258 resp = self.app.get(url, expect_errors=True)
259 self.assertEqual(200, resp.status_code, (resp.body, sort, state)) 259 self.assertEqual(200, resp.status_code, (resp.body, sort, state))
260 260
261 self.app.get('/user/tasks?sort=foo', status=400) 261 self.app.get('/user/tasks?sort=foo', status=400)
262 self.app.get('/user/tasks?state=foo', status=400) 262 self.app.get('/user/tasks?state=foo', status=400)
263 263
264 def test_task_search_task_name(self):
265 # Try all the combinations of task queries to ensure the index exist.
266 self.set_as_privileged_user()
267 self.client_create_task_raw()
268 self.app.get('/user/tasks?task_name=hi', status=200)
269 for sort, state in self._sort_state_product():
270 url = '/user/tasks?sort=%s&state=%s' % (sort, state)
271 self.app.get(url + '&task_name=hi', status=200)
272
273 def test_task_search_task_tag(self): 264 def test_task_search_task_tag(self):
274 # Try all the combinations of task queries to ensure the index exist. 265 # Try all the combinations of task queries to ensure the index exist.
275 self.set_as_privileged_user() 266 self.set_as_privileged_user()
276 self.client_create_task_raw() 267 self.client_create_task_raw()
277 self.set_as_bot() 268 self.set_as_bot()
278 reaped = self.bot_poll() 269 reaped = self.bot_poll()
279 self.bot_complete_task(task_id=reaped['manifest']['task_id']) 270 self.bot_complete_task(task_id=reaped['manifest']['task_id'])
280 self.set_as_privileged_user() 271 self.set_as_privileged_user()
281 self.app.get('/user/tasks?task_tag=yo:dawg', status=200) 272 self.app.get('/user/tasks?task_tag=yo:dawg', status=200)
282 for sort, state in self._sort_state_product(): 273 for sort, state in self._sort_state_product():
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 url, headers={'X-AppEngine-QueueName': 'bogus name'}, status=403) 473 url, headers={'X-AppEngine-QueueName': 'bogus name'}, status=403)
483 474
484 475
485 if __name__ == '__main__': 476 if __name__ == '__main__':
486 if '-v' in sys.argv: 477 if '-v' in sys.argv:
487 unittest.TestCase.maxDiff = None 478 unittest.TestCase.maxDiff = None
488 logging.basicConfig( 479 logging.basicConfig(
489 level=logging.DEBUG if '-v' in sys.argv else logging.CRITICAL, 480 level=logging.DEBUG if '-v' in sys.argv else logging.CRITICAL,
490 format='%(levelname)-7s %(filename)s:%(lineno)3d %(message)s') 481 format='%(levelname)-7s %(filename)s:%(lineno)3d %(message)s')
491 unittest.main() 482 unittest.main()
OLDNEW
« no previous file with comments | « appengine/swarming/handlers_frontend.py ('k') | appengine/swarming/server/task_result.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698