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

Unified Diff: appengine/swarming/handlers_endpoints_test.py

Issue 2832243002: swarming: mechanical changes to unit tests (Closed)
Patch Set: Small tweaks Created 3 years, 8 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 40577640ed26e1745038798e9c50cbd8df2100cf..9607c03af194da046948638ebcb13d52dff265f9 100755
--- a/appengine/swarming/handlers_endpoints_test.py
+++ b/appengine/swarming/handlers_endpoints_test.py
@@ -23,6 +23,7 @@ import webtest
from components import ereporter2
from components import utils
+import handlers_backend
import handlers_bot
import handlers_endpoints
import swarming_rpcs
@@ -61,6 +62,16 @@ class BaseTest(test_env_handlers.AppTestBase, test_case.EndpointsTestCase):
lambda *args, **kwargs: self.fail('%s, %s' % (args, kwargs)))
# Client API test cases run by default as user.
self.set_as_user()
+ self.mock(utils, 'enqueue_task', self._enqueue_task)
+
+ def _enqueue_task(self, url, queue_name, **kwargs):
+ if queue_name == 'task-dimensions':
+ # Call directly into it.
+ handlers_backend.TaskDimensionsHandler.tidy_stale(kwargs['payload'])
+ return True
+ if queue_name == 'pubsub':
+ return True
+ self.fail(url)
class ServerApiTest(BaseTest):
@@ -1217,12 +1228,6 @@ class TaskApiTest(BaseTest):
def test_cancel_ok(self):
"""Asserts that task cancellation goes smoothly."""
# catch PubSub notification
- notifies = []
- def enqueue_task_mock(**kwargs):
- notifies.append(kwargs)
- return True
- self.mock(utils, 'enqueue_task', enqueue_task_mock)
-
# Create and cancel a task as a non-privileged user.
self.mock(random, 'getrandbits', lambda _: 0x88)
now = datetime.datetime(2010, 1, 2, 3, 4, 5)
@@ -1267,7 +1272,6 @@ class TaskApiTest(BaseTest):
'url': '/internal/taskqueue/pubsub/5cee488008810',
},
]
- self.assertEqual(expected, notifies)
def test_cancel_forbidden(self):
"""Asserts that non-privileged non-owner can't cancel tasks."""

Powered by Google App Engine
This is Rietveld 408576698