def _create_api(args): api_version = "APIv{}".format(args.api_version) api_key, subscriber = _read_api_key_and_subscriber_status(args.config_file) subscriber = False return AbuseIpDb(api_key=api_key, api_version=api_version, subscriber=subscriber)
def test_instantiate__empty_key_provided(self, request): with self.assertRaises(ValueError): AbuseIpDb('') request.assert_not_called()
def get_api(self): return AbuseIpDb('some_API_key', 'APIv2')
def test_instantiate__invalid_api_version_provided(self, request): with self.assertRaises(ValueError): AbuseIpDb('some_API_key', api_version='InvalidAPIversion') request.assert_not_called()