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

Unified Diff: appengine/swarming/handlers_endpoints_test.py

Issue 2984843002: swarming: switch to a 'capability focused' ACL system (Closed)
Patch Set: Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: appengine/swarming/handlers_endpoints_test.py
diff --git a/appengine/swarming/handlers_endpoints_test.py b/appengine/swarming/handlers_endpoints_test.py
index b42f769feaed0caf34c5dbcf3d2e3992c1044142..beab5aa08a9c2ca4799ac6d99063fa745e636b0a 100755
--- a/appengine/swarming/handlers_endpoints_test.py
+++ b/appengine/swarming/handlers_endpoints_test.py
@@ -1352,25 +1352,23 @@ class TaskApiTest(BaseTest):
out.update((unicode(k), v) for k, v in kwargs.iteritems())
return out
- def _cycle(params, expected, must_stop):
- response = self.post_json('/swarming/api/v1/bot/task_update', params)
- self.assertEqual({u'must_stop': must_stop, u'ok': True}, response)
- self.assertEqual(expected, self.client_get_results(task_id))
-
+ self.set_as_bot()
params = _params(output=base64.b64encode('Oh '))
- expected = _expected()
- _cycle(params, expected, False)
+ response = self.post_json('/swarming/api/v1/bot/task_update', params)
+ self.assertEqual({u'must_stop': False, u'ok': True}, response)
+ self.set_as_user()
+ self.assertEqual(_expected(), self.client_get_results(task_id))
# Canceling a running task is currently not supported.
- self.set_as_user()
- expected = {u'ok': False, u'was_running': True}
response = self.call_api('cancel', body={'task_id': task_id})
- self.assertEqual(expected, response.json)
+ self.assertEqual({u'ok': False, u'was_running': True}, response.json)
self.set_as_bot()
params = _params(output=base64.b64encode('hi'), output_chunk_start=3)
- expected = _expected()
- _cycle(params, expected, False)
+ response = self.post_json('/swarming/api/v1/bot/task_update', params)
+ self.assertEqual({u'must_stop': False, u'ok': True}, response)
+ self.set_as_user()
+ self.assertEqual(_expected(), self.client_get_results(task_id))
def test_result_unknown(self):
"""Asserts that result raises 404 for unknown task IDs."""
@@ -1945,7 +1943,7 @@ class BotApiTest(BaseTest):
def test_delete_ok(self):
"""Assert that delete finds and deletes a bot."""
self.set_as_admin()
- self.mock(acl, 'is_admin', lambda *_args, **_kwargs: True)
+ self.mock(acl, '_is_admin', lambda *_args, **_kwargs: True)
now = datetime.datetime(2010, 1, 2, 3, 4, 5, 6)
self.mock_now(now)
state = {

Powered by Google App Engine
This is Rietveld 408576698