Skip to content

Commit

Permalink
Merge pull request #720 from mgorny/unittest-mock
Browse files Browse the repository at this point in the history
Use unittest.mock instead of external mock
  • Loading branch information
JonathanHuot committed Mar 16, 2020
2 parents b71636e + 394c019 commit d4716eb
Show file tree
Hide file tree
Showing 38 changed files with 37 additions and 38 deletions.
1 change: 0 additions & 1 deletion requirements-test.txt
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
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
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
Expand Up @@ -11,7 +11,7 @@
"""
import json

import mock
from unittest import mock

from oauthlib.oauth2 import (BackendApplicationServer, LegacyApplicationServer,
MobileApplicationServer, RequestValidator,
Expand Down
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
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
@@ -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
@@ -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
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
@@ -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
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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -1,4 +1,4 @@
import mock
from unittest import mock

from oauthlib.common import Request
from oauthlib.oauth2.rfc6749.tokens import (
Expand Down
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
@@ -1,4 +1,4 @@
import mock
from unittest import mock

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

from oauthlib.openid import RequestValidator
Expand Down
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -1,4 +1,4 @@
import mock
from unittest import mock

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

Expand Down

0 comments on commit d4716eb

Please sign in to comment.