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

Unified Diff: appengine/swarming/handlers_bot_test.py

Issue 2832243002: swarming: mechanical changes to unit tests (Closed)
Patch Set: Disable tx before calling tq 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
« no previous file with comments | « appengine/components/test_support/test_case.py ('k') | appengine/swarming/handlers_endpoints_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/swarming/handlers_bot_test.py
diff --git a/appengine/swarming/handlers_bot_test.py b/appengine/swarming/handlers_bot_test.py
index 921c9ea3dc7ef0d58d4d32bc5e877efdb72435de..aa61a8981114ece741526a209e46900c1aa5e04e 100755
--- a/appengine/swarming/handlers_bot_test.py
+++ b/appengine/swarming/handlers_bot_test.py
@@ -23,6 +23,7 @@ from google.appengine.ext import ndb
import webapp2
import webtest
+import handlers_backend
import handlers_bot
from components import ereporter2
from components import utils
@@ -54,6 +55,18 @@ class BotApiTest(test_env_handlers.AppTestBase):
lambda *args, **kwargs: self.fail('%s, %s' % (args, kwargs)))
# Bot API test cases run by default as bot.
self.set_as_bot()
+ self._enqueue_task_orig = self.mock(
+ utils, 'enqueue_task', self._enqueue_task)
+
+ @ndb.non_transactional
+ def _enqueue_task(self, url, queue_name, **kwargs):
+ if queue_name == 'task-dimensions':
+ # Call directly into it, ignores any current transaction.
+ handlers_backend.TaskDimensionsHandler.tidy_stale(kwargs['payload'])
+ return True
+ if queue_name == 'pubsub':
+ return True
+ self.fail(url)
def test_handshake(self):
errors = []
« no previous file with comments | « appengine/components/test_support/test_case.py ('k') | appengine/swarming/handlers_endpoints_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698