From c0c0c1f2fa4992c7aba5022a2521a06769cbe4d2 Mon Sep 17 00:00:00 2001 From: Angel-Dijoux Date: Mon, 1 Jan 2024 01:40:34 +0100 Subject: [PATCH] feat: add types --- .../scrap/tests/unit/test_connect_to_onisep_api.py | 8 ++++---- .../scrap/tests/unit/test_search_onisep_formations.py | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/business_logic/formation/scrap/tests/unit/test_connect_to_onisep_api.py b/src/business_logic/formation/scrap/tests/unit/test_connect_to_onisep_api.py index 637ebd3..a3a9b50 100644 --- a/src/business_logic/formation/scrap/tests/unit/test_connect_to_onisep_api.py +++ b/src/business_logic/formation/scrap/tests/unit/test_connect_to_onisep_api.py @@ -1,4 +1,4 @@ -from unittest.mock import MagicMock, patch +from unittest.mock import _Mock, MagicMock, patch import pytest from src.business_logic.formation.exceptions import NoOnisepAPIException @@ -19,7 +19,7 @@ def mock_onisep_request(): yield mock_requests_get -def test_get_onisep_data_successful(mock_onisep_request): +def test_get_onisep_data_successful(mock_onisep_request: _Mock): # Arrange mock_response = MagicMock() mock_response.status_code = HTTP_200_OK @@ -31,7 +31,7 @@ def test_get_onisep_data_successful(mock_onisep_request): assert result == {"total": "5173"} -def test_get_onisep_data_retry_after_unauthorized(mock_onisep_request): +def test_get_onisep_data_retry_after_unauthorized(mock_onisep_request: _Mock): # Arrange unauthorized_response = MagicMock() unauthorized_response.status_code = HTTP_401_UNAUTHORIZED @@ -49,7 +49,7 @@ def test_get_onisep_data_retry_after_unauthorized(mock_onisep_request): assert result == {"total": "5173"} -def test_get_onisep_data_raises_exception(mock_onisep_request): +def test_get_onisep_data_raises_exception(mock_onisep_request: _Mock): # Arrange mock_response = MagicMock() mock_response.status_code = HTTP_500_INTERNAL_SERVER_ERROR diff --git a/src/business_logic/formation/scrap/tests/unit/test_search_onisep_formations.py b/src/business_logic/formation/scrap/tests/unit/test_search_onisep_formations.py index 37c6aee..fcfdcc1 100644 --- a/src/business_logic/formation/scrap/tests/unit/test_search_onisep_formations.py +++ b/src/business_logic/formation/scrap/tests/unit/test_search_onisep_formations.py @@ -1,4 +1,4 @@ -from unittest.mock import patch +from unittest.mock import patch, _Mock import pytest from src.business_logic.formation.scrap.search_formation import ( @@ -52,7 +52,7 @@ def mock_search_formations(): def test_search_formations_should_return_formations_without_favorite( - mock_search_formations, + mock_search_formations: _Mock, ): # Arrange mock_search_formations.return_value = MOKED_RESEARCH @@ -72,7 +72,7 @@ def test_search_formations_should_return_formations_without_favorite( def test_authenticated_search_formations_should_return_formations_with_favorite( - mock_search_formations, db_session + mock_search_formations: _Mock, db_session ): # Arrange mock_search_formations.return_value = MOKED_RESEARCH