예제 #1
0
    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
예제 #2
0
파일: tokens_test.py 프로젝트: hypothesis/h
    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
예제 #3
0
    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"
예제 #4
0
파일: tokens_test.py 프로젝트: ziqizh/h
    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'
예제 #5
0
파일: tokens_test.py 프로젝트: hypothesis/h
    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"
예제 #6
0
 def test_init_sets_instance_vars(self, attr):
     value = mock.Mock()
     token = BearerToken(**{attr: value})
     assert getattr(token, attr) == value