class NullAuthorizerTests(CapturedIOTestCase): def setUp(self): """ Initializes a NullAuthorizer for testing """ super(NullAuthorizerTests, self).setUp() self.authorizer = NullAuthorizer() def test_set_authorization_header(self): """ Sets authorization header in a test dictionary, Confirms that nothing happens. and any existing Authorization header is removed """ header_dict = {} self.authorizer.set_authorization_header(header_dict) self.assertEqual(header_dict, {}) def test_set_authorization_header_existing(self): """ Confirms that an existing Authorization field is removed """ header_dict = {"Header": "value", "Authorization": "previous_value"} self.authorizer.set_authorization_header(header_dict) self.assertEqual(header_dict, {"Header": "value"}) def test_handle_missing_authorization(self): """ Confirms that NullAuthorizer doesn't handle missing authorization """ self.assertFalse(self.authorizer.handle_missing_authorization())
def test_set_authorization_header_existing(): """ Confirms that an existing Authorization field is removed """ header_dict = {"Header": "value", "Authorization": "previous_value"} authorizer = NullAuthorizer() authorizer.set_authorization_header(header_dict) assert header_dict == {"Header": "value"}
def test_set_authorization_header(): """ Sets authorization header in a test dictionary, Confirms that nothing happens. and any existing Authorization header is removed """ header_dict = {} authorizer = NullAuthorizer() authorizer.set_authorization_header(header_dict) assert header_dict == {}
def test_will_null_authz_header_with_null_authorizer(): request = mock.Mock() request.headers = {} transport = RequestsTransport() transport._set_authz_header(NullAuthorizer(), request) assert request.headers == {} request.headers["Authorization"] = "foo bar" transport._set_authz_header(NullAuthorizer(), request) assert request.headers == {}
def __init__(self, client_id: str, **kwargs: Any) -> None: if "authorizer" in kwargs: log.error("ArgumentError(NativeAppClient.authorizer)") raise exc.GlobusSDKUsageError( "Cannot give a NativeAppAuthClient an authorizer" ) super().__init__(client_id=client_id, authorizer=NullAuthorizer(), **kwargs) log.info(f"Finished initializing client, client_id={client_id}")
def __init__(self, client_id, **kwargs): if "authorizer" in kwargs: logger.error("ArgumentError(NativeAppClient.authorizer)") raise GlobusSDKUsageError("Cannot give a NativeAppAuthClient an authorizer") AuthClient.__init__( self, client_id=client_id, authorizer=NullAuthorizer(), **kwargs ) self.logger.info(f"Finished initializing client, client_id={client_id}")
def __init__(self, client_id, **kwargs): if "authorizer" in kwargs: logger.error('ArgumentError(NativeAppClient.authorizer)') raise ValueError( "Cannot give a NativeAppAuthClient an authorizer") AuthClient.__init__( self, client_id=client_id, authorizer=NullAuthorizer(), **kwargs) self.logger.info('Finished initializing client, client_id={}' .format(client_id))
def test_get_authorization_header(): """ Gets authorization header. Confirms None value. """ authorizer = NullAuthorizer() assert authorizer.get_authorization_header() is None
def test_handle_missing_authorization(): """ Confirms that NullAuthorizer doesn't handle missing authorization """ authorizer = NullAuthorizer() assert not authorizer.handle_missing_authorization()
def test_handle_missing_authorization(): """ Confirms that NullAuthorizer doesn't handle missing authorization """ authorizer = NullAuthorizer() assert not authorizer.handle_missing_authorization()
def setUp(self): """ Initializes a NullAuthorizer for testing """ super(NullAuthorizerTests, self).setUp() self.authorizer = NullAuthorizer()