Esempio n. 1
0
 def test_verify_api_key_usage_inactive(self):
     arguments = MockArgumentParser()
     client = FlaskRestBotClient("flask", 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))
Esempio n. 2
0
 def test_verify_api_key_usage_inactive(self):
     arguments = MockArgumentParser()
     client = FlaskRestBotClient("flask", 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))
Esempio n. 3
0
 def test_verify_api_key_usage_active(self):
     arguments = MockArgumentParser()
     client = FlaskRestBotClient("flask", 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.args = {}
     request.args['apikey'] = '11111111'
     self.assertEqual((None, None),client.verify_api_key_usage(request))
Esempio n. 4
0
 def test_verify_api_key_usage_active(self):
     arguments = MockArgumentParser()
     client = FlaskRestBotClient("flask", 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.args = {}
     request.args['apikey'] = '11111111'
     self.assertEquals((None, None),client.verify_api_key_usage(request))