コード例 #1
0
 def setUp(self):
   super(DatastoreHooksTest, self).setUp()
   testing_common.SetIsInternalUser('*****@*****.**', True)
   testing_common.SetIsInternalUser('*****@*****.**', False)
   self._AddDataToDatastore()
   datastore_hooks.InstallHooks()
   self.PatchDatastoreHooksRequest()
コード例 #2
0
 def testGet_WithNonInternalUserAndWhitelistedIP(self):
   self._AddMockInternalData()
   self.UnsetCurrentUser()
   datastore_hooks.InstallHooks()
   testing_common.SetIpWhitelist(['123.45.67.89'])
   query = '/graph_csv?test_path=ChromiumPerf/win7/dromaeo/dom&num_points=3'
   expected = [['revision', 'value']]
   self._CheckGet(query, expected)
コード例 #3
0
 def testGet_InternalTestDataUnauthorized_DoesntShowData(self):
     """Tests a query for internal data for an unauthorized user."""
     self._AddInternalSampleData()
     self.UnsetCurrentUser()
     datastore_hooks.InstallHooks()
     response = self.testapp.get('/new_points')
     # Only the header row is listed, not any others rows.
     self.assertEqual(1, len(re.findall(r'<tr>', response.body)))
コード例 #4
0
 def setUp(self):
     super(ListTestsTest, self).setUp()
     app = webapp2.WSGIApplication([('/list_tests',
                                     list_tests.ListTestsHandler)])
     self.testapp = webtest.TestApp(app)
     datastore_hooks.InstallHooks()
     self.UnsetCurrentUser()
     testing_common.SetInternalDomain('google.com')
コード例 #5
0
 def setUp(self):
     super(ListTestsTest, self).setUp()
     app = webapp2.WSGIApplication([('/list_tests',
                                     list_tests.ListTestsHandler)])
     self.testapp = webtest.TestApp(app)
     datastore_hooks.InstallHooks()
     self.UnsetCurrentUser()
     testing_common.SetIsInternalUser('*****@*****.**', True)
     testing_common.SetIsInternalUser('*****@*****.**', False)
コード例 #6
0
 def setUp(self):
     super(DatastoreHooksTest, self).setUp()
     testing_common.SetInternalDomain('google.com')
     self._AddDataToDatastore()
     datastore_hooks.InstallHooks()
     get_request_patcher = mock.patch(
         'webapp2.get_request', mock.MagicMock(return_value=FakeRequest()))
     self.mock_get_request = get_request_patcher.start()
     self.addCleanup(get_request_patcher.stop)
コード例 #7
0
 def setUp(self):
   super(ListTestSuitesTest, self).setUp()
   app = webapp2.WSGIApplication(
       [('/update_test_suites',
         update_test_suites.UpdateTestSuitesHandler)])
   self.testapp = webtest.TestApp(app)
   datastore_hooks.InstallHooks()
   testing_common.SetIsInternalUser('*****@*****.**', True)
   self.UnsetCurrentUser()
コード例 #8
0
 def testGet_InternalTestDataAuthorized_ShowsData(self):
     """Tests a query for internal data when the user should be authorized."""
     self._AddInternalSampleData()
     # The user doesn't need to be authorized as admin to view internal data,
     # they only need to have an internal email address.
     self.SetCurrentUser('*****@*****.**')
     datastore_hooks.InstallHooks()
     response = self.testapp.get('/new_points')
     # 50 rows for xtest, 1 for the header.
     self.assertEqual(51, len(re.findall(r'<tr>', response.body)))
コード例 #9
0
ファイル: graph_csv_test.py プロジェクト: stevenjb/catapult
 def testGet_WhitelistedIPOnly(self):
   self.PatchDatastoreHooksRequest('123.45.67.89')
   self._AddMockInternalData()
   self.UnsetCurrentUser()
   datastore_hooks.InstallHooks()
   testing_common.SetIpWhitelist(['123.45.67.89'])
   query = '/graph_csv?test_path=ChromiumPerf/win7/dromaeo/dom&num_points=3'
   expected = [
       ['revision', 'value'],
       ['47', '94.0'],
       ['48', '96.0'],
       ['49', '98.0']
   ]
   self._CheckGet(query, expected, whitelisted_ip='123.45.67.89')
コード例 #10
0
This module is loaded before others and can be used to set up the
App Engine environment. See:
  https://cloud.google.com/appengine/docs/python/tools/appengineconfig
"""

import logging
import os
import sys

from google.appengine.ext import vendor

import dashboard

from dashboard import datastore_hooks

datastore_hooks.InstallHooks()

appstats_SHELL_OK = True

# Allows remote_api from the peng team to support the crosbolt dashboard.
remoteapi_CUSTOM_ENVIRONMENT_AUTHENTICATION = ('LOAS_PEER_USERNAME',
                                               ['chromeos-peng-performance'])


def _AddThirdPartyLibraries():
    """Registers the third party libraries with App Engine.

  In order for third-party libraries to be available in the App Engine
  runtime environment, they must be added with vendor.add. The directories
  added this way must be inside the App Engine project directory.
  """