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
示例#2
0
    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
示例#3
0
 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
示例#4
0
 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'
示例#5
0
 def test_it_provides_user_service(self, pyramid_request, user_service):
     svc = oauth.oauth_service_factory(None, pyramid_request)
     assert svc.usersvc == user_service
示例#6
0
 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
示例#7
0
 def test_it_returns_oauth_service(self, pyramid_request):
     svc = oauth.oauth_service_factory(None, pyramid_request)
     assert isinstance(svc, oauth.OAuthService)
示例#8
0
 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'
示例#9
0
 def test_it_provides_user_service(self, pyramid_request, user_service):
     svc = oauth.oauth_service_factory(None, pyramid_request)
     assert svc.usersvc == user_service
示例#10
0
 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
示例#11
0
 def test_it_returns_oauth_service(self, pyramid_request):
     svc = oauth.oauth_service_factory(None, pyramid_request)
     assert isinstance(svc, oauth.OAuthService)
示例#12
0
 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