示例#1
0
 def test_verify_api_key_usage_inactive(self):
     arguments = MockArgumentParser()
     client = SanicRestBotClient("sanic", arguments)
     self.assertIsNotNone(client)
     client.configuration.client_configuration._use_api_keys = False
     request = unittest.mock.Mock()
     self.assertEquals((None, None),client.verify_api_key_usage(request))
示例#2
0
 def test_verify_api_key_usage_inactive(self):
     arguments = MockArgumentParser()
     client = SanicRestBotClient("sanic", arguments)
     self.assertIsNotNone(client)
     client.configuration.client_configuration._use_api_keys = False
     request = unittest.mock.Mock()
     self.assertEqual((None, None),
                      client.verify_api_key_usage(request))
示例#3
0
 def test_verify_api_key_usage_active(self):
     arguments = MockArgumentParser()
     client = SanicRestBotClient("sanic", arguments)
     self.assertIsNotNone(client)
     client.configuration.client_configuration._use_api_keys = True
     client.configuration.client_configuration._api_key_file = os.path.dirname(__file__) + os.sep + ".." + os.sep + ".." + os.sep + "api_keys.txt"
     client.load_api_keys()
     request = unittest.mock.Mock()
     request.raw_args = {}
     request.raw_args['apikey'] = '11111111'
     self.assertEquals((None, None),client.verify_api_key_usage(request))
示例#4
0
 def test_verify_api_key_usage_active(self):
     arguments = MockArgumentParser()
     client = SanicRestBotClient("sanic", arguments)
     self.assertIsNotNone(client)
     client.configuration.client_configuration._use_api_keys = True
     client.configuration.client_configuration._api_key_file = os.path.dirname(
         __file__
     ) + os.sep + ".." + os.sep + ".." + os.sep + "api_keys.txt"
     client.load_api_keys()
     request = unittest.mock.Mock()
     request.raw_args = {}
     request.raw_args['apikey'] = '11111111'
     self.assertEqual((None, None),
                      client.verify_api_key_usage(request))