diff --git a/test/search_api/endpoints/test_count_endpoint.py b/test/search_api/endpoints/test_count_endpoint.py index c6179ad8..1bf37101 100644 --- a/test/search_api/endpoints/test_count_endpoint.py +++ b/test/search_api/endpoints/test_count_endpoint.py @@ -1,9 +1,6 @@ -from unittest.mock import patch - import pytest from datagateway_api.src.common.config import Config -from datagateway_api.src.common.date_handler import DateHandler class TestSearchAPICountEndpoint: @@ -106,27 +103,9 @@ def test_valid_count_endpoint( ), ], ) - @patch("datagateway_api.src.search_api.query_filter_factory.datetime") def test_valid_count_endpoint_is_public_field( - self, - datetime_mock, - flask_test_app_search_api, - endpoint_name, - request_filter, - expected_json, + self, flask_test_app_search_api, endpoint_name, request_filter, expected_json, ): - """ - The datetime must be mocked here to prevent tests from failing as time passes. - A dataset or document that was created or released 2 years and 364 ago would be - fall in the not public category, however that same dataset or document would - fall in the public category (in the case of ISIS) a few days later because it - will be 3 years old. As a result of this, the tests will fail because the actual - count will be different to that of the expected. Mocking datetime takes care of - this issue because it sets the time to the one provided in this test method. - """ - datetime_mock.now.return_value = DateHandler.str_to_datetime_object( - "2022-02-06 00:00:01+00:00", - ) test_response = flask_test_app_search_api.get( f"{Config.config.search_api.extension}/{endpoint_name}/count?where=" f"{request_filter}",