def setUp(self): super(V1ApiTest, self).setUp() gae_ts_mon.reset_for_unittest(disable=True) auth.disable_process_cache() user.clear_request_cache() self.patch( 'components.utils.utcnow', return_value=datetime.datetime(2017, 1, 1) ) self.future_date = utils.utcnow() + datetime.timedelta(days=1) # future_ts is str because INT64 values are formatted as strings. self.future_ts = str(utils.datetime_to_timestamp(self.future_date)) config.put_bucket( 'chromium', 'a' * 40, test_util.parse_bucket_cfg( ''' name: "luci.chromium.try" acls { role: SCHEDULER identity: "anonymous:anonymous" } ''' ), ) self.build_infra = test_util.build_bundle(id=1).infra self.build_infra.put()
def setUpTests(self): gae_ts_mon.reset_for_unittest(disable=True) auth.disable_process_cache() self.future_date = utils.utcnow() + datetime.timedelta(minutes=1) # future_ts is str because INT64 values are formatted as strings. self.future_ts = str(utils.datetime_to_timestamp(self.future_date)) self.test_build = model.Build( id=1, bucket='chromium', parameters={ 'buildername': 'linux_rel', }, )
# Copyright 2014 The Swarming Authors. All rights reserved. # Use of this source code is governed by the Apache v2.0 license that can be # found in the LICENSE file. import webapp2 from components import auth from components import utils class WarmupHandler(webapp2.RequestHandler): def get(self): auth.warmup() self.response.headers['Content-Type'] = 'text/plain; charset=utf-8' self.response.write('ok') assert utils.is_local_dev_server() auth.disable_process_cache() # Add a fake admin for local dev server. if not auth.is_replica(): auth.bootstrap_group( auth.ADMIN_GROUP, [auth.Identity(auth.IDENTITY_USER, '*****@*****.**')], 'Users that can manage groups') # /_ah/warmup is used by the smoke test to detect that app is alive. app = webapp2.WSGIApplication([webapp2.Route(r'/_ah/warmup', WarmupHandler)], debug=True)
from google.appengine.api import datastore_errors from google.appengine.ext import ndb from components import auth from components import utils class WarmupHandler(webapp2.RequestHandler): def get(self): auth.warmup() self.response.headers['Content-Type'] = 'text/plain; charset=utf-8' self.response.write('ok') assert utils.is_local_dev_server() auth.disable_process_cache() # See components/auth/change_log.py, is_changle_log_indexed. ndb.add_flow_exception(datastore_errors.NeedIndexError) # Add a fake admin for local dev server. if not auth.is_replica(): auth.bootstrap_group( auth.ADMIN_GROUP, [auth.Identity(auth.IDENTITY_USER, '*****@*****.**')], 'Users that can manage groups') # /_ah/warmup is used by the smoke test to detect that app is alive. app = webapp2.WSGIApplication( [webapp2.Route(r'/_ah/warmup', WarmupHandler)], debug=True)