def oauth_service(self, pyramid_config, pyramid_request, token): svc = mock.Mock(spec_set=oauth_service_factory(None, pyramid_request)) svc.verify_token_request.return_value = (mock.sentinel.user, mock.sentinel.authclient) svc.create_token.return_value = token pyramid_config.register_service(svc, name='oauth') return svc
def oauth_service(self, pyramid_config, pyramid_request): svc = mock.Mock(spec_set=oauth_service_factory(None, pyramid_request)) svc.get_authclient_by_id.return_value = mock.Mock(authority='example.com') pyramid_config.register_service(svc, name='oauth') return svc
def oauth_service(self, pyramid_config, pyramid_request): svc = mock.Mock(spec_set=oauth_service_factory(None, pyramid_request)) svc.verify_jwt_bearer.return_value = (mock.sentinel.user, mock.sentinel.authclient) pyramid_config.register_service(svc, name='oauth') return svc
def test_it_provides_request_domain(self, pyramid_request): pyramid_request.domain = 'example.org' svc = oauth.oauth_service_factory(None, pyramid_request) assert svc.domain == 'example.org'
def test_it_provides_user_service(self, pyramid_request, user_service): svc = oauth.oauth_service_factory(None, pyramid_request) assert svc.usersvc == user_service
def test_it_provides_request_db_as_session(self, pyramid_request): svc = oauth.oauth_service_factory(None, pyramid_request) assert svc.session == pyramid_request.db
def test_it_returns_oauth_service(self, pyramid_request): svc = oauth.oauth_service_factory(None, pyramid_request) assert isinstance(svc, oauth.OAuthService)
def test_it_provides_request_domain(self, pyramid_request): pyramid_request.domain = 'example.org' svc = oauth.oauth_service_factory(None, pyramid_request) assert svc.domain == 'example.org'
def test_it_provides_user_service(self, pyramid_request, user_service): svc = oauth.oauth_service_factory(None, pyramid_request) assert svc.usersvc == user_service
def test_it_provides_request_db_as_session(self, pyramid_request): svc = oauth.oauth_service_factory(None, pyramid_request) assert svc.session == pyramid_request.db
def test_it_returns_oauth_service(self, pyramid_request): svc = oauth.oauth_service_factory(None, pyramid_request) assert isinstance(svc, oauth.OAuthService)
def oauth_service(self, pyramid_config, pyramid_request): svc = mock.Mock(spec_set=oauth_service_factory(None, pyramid_request)) svc.verify_jwt_bearer.return_value = (mock.sentinel.user, mock.sentinel.authclient) pyramid_config.register_service(svc, name='oauth') return svc