mirror of
https://github.com/ansible-collections/community.crypto.git
synced 2026-03-26 21:33:25 +00:00
Use unittest.mock. (#881)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
minor_changes:
|
||||
- "Python code modernization: use f-strings instead of ``%`` and ``str.format()`` (https://github.com/ansible-collections/community.crypto/pull/875)."
|
||||
- "Python code modernization: update ``__future__`` imports, remove Python 2 specific boilerplates (https://github.com/ansible-collections/community.crypto/pull/876)."
|
||||
- "Python code modernization: use ``unittest.mock`` instead of ``ansible_collections.community.internal_test_tools.tests.unit.compat.mock`` (https://github.com/ansible-collections/community.crypto/pull/881)."
|
||||
- "Python code modernization: remove Python 3 specific code (https://github.com/ansible-collections/community.crypto/pull/877)."
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import datetime
|
||||
from unittest.mock import (
|
||||
MagicMock,
|
||||
)
|
||||
|
||||
import pytest
|
||||
from ansible_collections.community.crypto.plugins.module_utils.acme.backend_cryptography import (
|
||||
@@ -18,9 +21,6 @@ from ansible_collections.community.crypto.plugins.module_utils.time import (
|
||||
UTC,
|
||||
ensure_utc_timezone,
|
||||
)
|
||||
from ansible_collections.community.internal_test_tools.tests.unit.compat.mock import (
|
||||
MagicMock,
|
||||
)
|
||||
from freezegun import freeze_time
|
||||
|
||||
from ..test_time import TIMEZONES
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import datetime
|
||||
from unittest.mock import (
|
||||
MagicMock,
|
||||
)
|
||||
|
||||
import pytest
|
||||
from ansible_collections.community.crypto.plugins.module_utils.acme.backend_openssl_cli import (
|
||||
@@ -14,9 +17,6 @@ from ansible_collections.community.crypto.plugins.module_utils.time import (
|
||||
UTC,
|
||||
ensure_utc_timezone,
|
||||
)
|
||||
from ansible_collections.community.internal_test_tools.tests.unit.compat.mock import (
|
||||
MagicMock,
|
||||
)
|
||||
from freezegun import freeze_time
|
||||
|
||||
from .backend_data import (
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from unittest.mock import (
|
||||
MagicMock,
|
||||
)
|
||||
|
||||
import pytest
|
||||
from ansible_collections.community.crypto.plugins.module_utils.acme.challenges import (
|
||||
Authorization,
|
||||
@@ -15,9 +19,6 @@ from ansible_collections.community.crypto.plugins.module_utils.acme.errors impor
|
||||
ACMEProtocolException,
|
||||
ModuleFailException,
|
||||
)
|
||||
from ansible_collections.community.internal_test_tools.tests.unit.compat.mock import (
|
||||
MagicMock,
|
||||
)
|
||||
|
||||
|
||||
def test_combine_identifier():
|
||||
|
||||
@@ -4,14 +4,15 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from unittest.mock import (
|
||||
MagicMock,
|
||||
)
|
||||
|
||||
import pytest
|
||||
from ansible_collections.community.crypto.plugins.module_utils.acme.errors import (
|
||||
ACMEProtocolException,
|
||||
format_error_problem,
|
||||
)
|
||||
from ansible_collections.community.internal_test_tools.tests.unit.compat.mock import (
|
||||
MagicMock,
|
||||
)
|
||||
|
||||
|
||||
TEST_FORMAT_ERROR_PROBLEM = [
|
||||
|
||||
@@ -4,13 +4,14 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from unittest.mock import (
|
||||
MagicMock,
|
||||
)
|
||||
|
||||
from ansible_collections.community.crypto.plugins.module_utils.acme.io import (
|
||||
read_file,
|
||||
write_file,
|
||||
)
|
||||
from ansible_collections.community.internal_test_tools.tests.unit.compat.mock import (
|
||||
MagicMock,
|
||||
)
|
||||
|
||||
|
||||
TEST_TEXT = r"""1234
|
||||
|
||||
@@ -4,14 +4,15 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from unittest.mock import (
|
||||
MagicMock,
|
||||
)
|
||||
|
||||
import pytest
|
||||
from ansible_collections.community.crypto.plugins.module_utils.acme.errors import (
|
||||
ACMEProtocolException,
|
||||
)
|
||||
from ansible_collections.community.crypto.plugins.module_utils.acme.orders import Order
|
||||
from ansible_collections.community.internal_test_tools.tests.unit.compat.mock import (
|
||||
MagicMock,
|
||||
)
|
||||
|
||||
|
||||
def test_order_from_json():
|
||||
|
||||
Reference in New Issue
Block a user