Beispiel #1
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)
Beispiel #2
0
 def setUp(self):
     super(PostBisectResultsTest, self).setUp()
     app = webapp2.WSGIApplication([
         ('/post_bisect_results',
          post_bisect_results.PostBisectResultsHandler)
     ])
     self.testapp = webtest.TestApp(app)
     testing_common.SetIpWhitelist([_WHITELISTED_IP])
     self._AddRietveldConfig()
Beispiel #3
0
 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')
Beispiel #4
0
 def testGet_NoTestPathGiven_GivesError(self):
   testing_common.SetIpWhitelist(['123.45.67.89'])
   self.testapp.get(
       '/graph_csv',
       extra_environ={'REMOTE_ADDR': '123.45.67.89'},
       status=400)
Beispiel #5
0
 def testPost_IPInWhiteList_Authorized(self):
     testing_common.SetIpWhitelist(['123.45.67.89', '98.76.54.32'])
     self.testapp.post('/whitelist_test',
                       {'data': json.dumps([_SAMPLE_POINT])},
                       extra_environ={'REMOTE_ADDR': '123.45.67.89'})