Skip to content

Use unittest.mock instead of external mock #720

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
-r requirements.txt
mock>=2.0
pytest>=4.0
pytest-cov>=2.6
2 changes: 1 addition & 1 deletion tests/oauth1/rfc5849/endpoints/test_access_token.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from mock import ANY, MagicMock
from unittest.mock import ANY, MagicMock

from oauthlib.oauth1 import RequestValidator
from oauthlib.oauth1.rfc5849 import Client
Expand Down
2 changes: 1 addition & 1 deletion tests/oauth1/rfc5849/endpoints/test_authorization.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from mock import MagicMock
from unittest.mock import MagicMock

from oauthlib.oauth1 import RequestValidator
from oauthlib.oauth1.rfc5849 import errors
Expand Down
2 changes: 1 addition & 1 deletion tests/oauth1/rfc5849/endpoints/test_base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from re import sub

from mock import MagicMock
from unittest.mock import MagicMock

from oauthlib.common import CaseInsensitiveDict, safe_string_equals
from oauthlib.oauth1 import Client, RequestValidator
Expand Down
2 changes: 1 addition & 1 deletion tests/oauth1/rfc5849/endpoints/test_request_token.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from mock import ANY, MagicMock
from unittest.mock import ANY, MagicMock

from oauthlib.oauth1 import RequestValidator
from oauthlib.oauth1.rfc5849 import Client
Expand Down
2 changes: 1 addition & 1 deletion tests/oauth1/rfc5849/endpoints/test_resource.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from mock import ANY, MagicMock
from unittest.mock import ANY, MagicMock

from oauthlib.oauth1 import RequestValidator
from oauthlib.oauth1.rfc5849 import Client
Expand Down
2 changes: 1 addition & 1 deletion tests/oauth1/rfc5849/endpoints/test_signature_only.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from mock import ANY, MagicMock
from unittest.mock import ANY, MagicMock

from oauthlib.oauth1 import RequestValidator
from oauthlib.oauth1.rfc5849 import Client
Expand Down
2 changes: 1 addition & 1 deletion tests/oauth2/rfc6749/clients/test_backend_application.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import os

from mock import patch
from unittest.mock import patch

from oauthlib import signals
from oauthlib.oauth2 import BackendApplicationClient
Expand Down
2 changes: 1 addition & 1 deletion tests/oauth2/rfc6749/clients/test_legacy_application.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import os

from mock import patch
from unittest.mock import patch

from oauthlib import signals
from oauthlib.oauth2 import LegacyApplicationClient
Expand Down
2 changes: 1 addition & 1 deletion tests/oauth2/rfc6749/clients/test_mobile_application.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import os

from mock import patch
from unittest.mock import patch

from oauthlib import signals
from oauthlib.oauth2 import MobileApplicationClient
Expand Down
2 changes: 1 addition & 1 deletion tests/oauth2/rfc6749/clients/test_service_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from time import time

import jwt
from mock import patch
from unittest.mock import patch

from oauthlib.common import Request
from oauthlib.oauth2 import ServiceApplicationClient
Expand Down
2 changes: 1 addition & 1 deletion tests/oauth2/rfc6749/clients/test_web_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
import warnings

from mock import patch
from unittest.mock import patch

from oauthlib import common, signals
from oauthlib.oauth2 import (BackendApplicationClient, Client,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"""
import json

import mock
from unittest import mock

from oauthlib.oauth2 import (BackendApplicationServer, LegacyApplicationServer,
MobileApplicationServer, RequestValidator,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""
import json

import mock
from unittest import mock

from oauthlib.oauth2 import (MobileApplicationServer, RequestValidator,
WebApplicationServer)
Expand Down
2 changes: 1 addition & 1 deletion tests/oauth2/rfc6749/endpoints/test_error_responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""
import json

import mock
from unittest import mock

from oauthlib.common import urlencode
from oauthlib.oauth2 import (BackendApplicationServer, LegacyApplicationServer,
Expand Down
2 changes: 1 addition & 1 deletion tests/oauth2/rfc6749/endpoints/test_extra_credentials.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Ensure extra credentials can be supplied for inclusion in tokens.
"""
import mock
from unittest import mock

from oauthlib.oauth2 import (BackendApplicationServer, LegacyApplicationServer,
MobileApplicationServer, RequestValidator,
Expand Down
2 changes: 1 addition & 1 deletion tests/oauth2/rfc6749/endpoints/test_introspect_endpoint.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from json import loads

from mock import MagicMock
from unittest.mock import MagicMock

from oauthlib.common import urlencode
from oauthlib.oauth2 import RequestValidator, IntrospectEndpoint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""
import json

import mock
from unittest import mock

from oauthlib.oauth2 import (BackendApplicationServer, LegacyApplicationServer,
MobileApplicationServer, RequestValidator,
Expand Down
2 changes: 1 addition & 1 deletion tests/oauth2/rfc6749/endpoints/test_revocation_endpoint.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from json import loads

from mock import MagicMock
from unittest.mock import MagicMock

from oauthlib.common import urlencode
from oauthlib.oauth2 import RequestValidator, RevocationEndpoint
Expand Down
2 changes: 1 addition & 1 deletion tests/oauth2/rfc6749/endpoints/test_scope_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""
import json

import mock
from unittest import mock

from oauthlib.oauth2 import (BackendApplicationServer, LegacyApplicationServer,
MobileApplicationServer, RequestValidator, Server,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import json

import mock
from unittest import mock

from oauthlib.common import Request
from oauthlib.oauth2.rfc6749 import errors
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import json

import mock
from unittest import mock

from oauthlib.common import Request
from oauthlib.oauth2.rfc6749.grant_types import ClientCredentialsGrant
Expand Down
2 changes: 1 addition & 1 deletion tests/oauth2/rfc6749/grant_types/test_implicit.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
import mock
from unittest import mock

from oauthlib.common import Request
from oauthlib.oauth2.rfc6749.grant_types import ImplicitGrant
Expand Down
2 changes: 1 addition & 1 deletion tests/oauth2/rfc6749/grant_types/test_refresh_token.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import json

import mock
from unittest import mock

from oauthlib.common import Request
from oauthlib.oauth2.rfc6749 import errors
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import json

import mock
from unittest import mock

from oauthlib.common import Request
from oauthlib.oauth2.rfc6749 import errors
Expand Down
2 changes: 1 addition & 1 deletion tests/oauth2/rfc6749/test_parameters.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from mock import patch
from unittest.mock import patch

from oauthlib import signals
from oauthlib.oauth2.rfc6749.errors import *
Expand Down
2 changes: 1 addition & 1 deletion tests/oauth2/rfc6749/test_server.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import json

import mock
from unittest import mock

from oauthlib import common
from oauthlib.oauth2.rfc6749 import errors, tokens
Expand Down
2 changes: 1 addition & 1 deletion tests/oauth2/rfc6749/test_tokens.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import mock
from unittest import mock

from oauthlib.common import Request
from oauthlib.oauth2.rfc6749.tokens import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
request the claims should be transferred (via the oauthlib request) to be persisted
with the Access Token when it is created.
"""
import mock
from unittest import mock

from oauthlib.openid import RequestValidator
from oauthlib.openid.connect.core.endpoints.pre_configured import Server
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import mock
from unittest import mock

from oauthlib.oauth2 import InvalidRequestError
from oauthlib.oauth2.rfc6749.endpoints.authorization import \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
import mock
from unittest import mock
import json

from oauthlib.openid import RequestValidator
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import json

import mock
from unittest import mock

from oauthlib.common import Request
from oauthlib.oauth2.rfc6749.tokens import BearerToken
Expand Down
2 changes: 1 addition & 1 deletion tests/openid/connect/core/grant_types/test_base.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
import mock
from unittest import mock
import time

from oauthlib.common import Request
Expand Down
2 changes: 1 addition & 1 deletion tests/openid/connect/core/grant_types/test_dispatchers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
import mock
from unittest import mock

from oauthlib.common import Request

Expand Down
2 changes: 1 addition & 1 deletion tests/openid/connect/core/grant_types/test_hybrid.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
import mock
from unittest import mock

from oauthlib.oauth2.rfc6749 import errors
from oauthlib.oauth2.rfc6749.tokens import BearerToken
Expand Down
2 changes: 1 addition & 1 deletion tests/openid/connect/core/grant_types/test_implicit.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
import mock
from unittest import mock

from oauthlib.common import Request
from oauthlib.oauth2.rfc6749 import errors
Expand Down
2 changes: 1 addition & 1 deletion tests/openid/connect/core/test_server.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import json

import mock
from unittest import mock

from oauthlib.oauth2.rfc6749 import errors
from oauthlib.oauth2.rfc6749.endpoints.authorization import AuthorizationEndpoint
Expand Down
2 changes: 1 addition & 1 deletion tests/openid/connect/core/test_tokens.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import mock
from unittest import mock

from oauthlib.openid.connect.core.tokens import JWTToken

Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy