def test_create_token_sets_refresh_token_expires_in(self, oauth_request): value = mock.Mock() token = BearerToken(request_validator=mock.Mock(), refresh_token_expires_in=value) assert oauth_request.extra_credentials is None token.create_token(oauth_request) assert oauth_request.extra_credentials.get( "refresh_token_expires_in") == value
def test_create_token_sets_refresh_token_expires_in(self, oauth_request): value = mock.Mock() token = BearerToken( request_validator=mock.Mock(), refresh_token_expires_in=value ) assert oauth_request.extra_credentials is None token.create_token(oauth_request) assert oauth_request.extra_credentials.get("refresh_token_expires_in") == value
def test_create_token_does_not_override_extras(self, oauth_request): value = mock.Mock() token = BearerToken(request_validator=mock.Mock(), refresh_token_expires_in=value) oauth_request.extra_credentials = {"foo": "bar"} token.create_token(oauth_request) assert oauth_request.extra_credentials.get( "refresh_token_expires_in") == value assert oauth_request.extra_credentials.get("foo") == "bar"
def test_create_token_does_not_override_extras(self, oauth_request): value = mock.Mock() token = BearerToken(request_validator=mock.Mock(), refresh_token_expires_in=value) oauth_request.extra_credentials = {'foo': 'bar'} token.create_token(oauth_request) assert oauth_request.extra_credentials.get( 'refresh_token_expires_in') == value assert oauth_request.extra_credentials.get('foo') == 'bar'
def test_create_token_does_not_override_extras(self, oauth_request): value = mock.Mock() token = BearerToken( request_validator=mock.Mock(), refresh_token_expires_in=value ) oauth_request.extra_credentials = {"foo": "bar"} token.create_token(oauth_request) assert oauth_request.extra_credentials.get("refresh_token_expires_in") == value assert oauth_request.extra_credentials.get("foo") == "bar"
def test_init_sets_instance_vars(self, attr): value = mock.Mock() token = BearerToken(**{attr: value}) assert getattr(token, attr) == value