def check_endpoint(value): """Check if the given endpoint is in the allowed ones.""" endpoints = ENDPOINTS.keys() if value not in endpoints: raise UsageError('This endpoint does not exist ({})'.format(', '.join( sorted(endpoints)))) return value
def add_parser_arguments(cls, add): # pylint: disable=arguments-differ super(Authenticator, cls).add_parser_arguments(add, default_propagation_seconds=60) add('endpoint', help='Endpoint to which OVH API Client should connect', choices=ENDPOINTS.keys(), default=None) add('application_key', help='Public key of your application', default=None) add('application_secret', help='Private key of your application', default=None) add('consumer_key', help='API key of your account', default=None) add('config_file', help='Config file with OVH credentials', default=None)
def test_endpoints(self): for endpoint in ENDPOINTS.keys(): auth_time = Client(endpoint).get('/auth/time', _need_auth=False) self.assertTrue(auth_time > 0)