Пример #1
0
 def testPostPermissionDenied(self):
     testing_common.SetIpWhitelist([])
     self.testapp.post('/api/isolate', status=401)
Пример #2
0
    def testPost_External_Oauth_Fails(self):
        testing_common.SetIpWhitelist(['invalid'])
        self.SetCurrentUserOAuth(testing_common.EXTERNAL_USER)
        self.SetCurrentClientIdOAuth(api_auth.OAUTH_CLIENT_ID_WHITELIST[0])

        self.Post('/api/isolate', self._ValidParams(), status=403)
Пример #3
0
    def testPost_Anonymous_Whitelisted_Succeeds(self):
        testing_common.SetIpWhitelist(['remote_ip'])
        self.SetCurrentUserOAuth(None)

        self.Post('/api/isolate', self._ValidParams(), status=200)
Пример #4
0
    def testPost_Anonymous_NotWhitelisted_Fails(self):
        testing_common.SetIpWhitelist(['invalid'])
        self.SetCurrentUserOAuth(None)

        self.Post('/api/isolate', self._ValidParams(), status=401)
 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'})