Skip to content

Commit

Permalink
freeze time too
Browse files Browse the repository at this point in the history
  • Loading branch information
ikonst committed May 26, 2024
1 parent 1c0cb93 commit a30a1bf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
pytest>=6
pytest-env
pytest-mock
freezegun

# only used in CI
coveralls
Expand Down
9 changes: 5 additions & 4 deletions tests/test_base_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
import base64
import json
from datetime import datetime
from uuid import UUID

import urllib3
Expand All @@ -15,6 +16,7 @@
from botocore.exceptions import BotoCoreError

import pytest
from freezegun import freeze_time

from pynamodb.connection import Connection
from pynamodb.connection.base import MetaTable
Expand Down Expand Up @@ -1517,11 +1519,10 @@ def test_connection__botocore_config():
assert c.client._client_config.max_pool_connections == 20


@mock.patch('botocore.httpsession.URLLib3Session.send')
def test_connection_make_api_call___extra_headers(send_mock, mocker):
@freeze_time()
def test_connection_make_api_call___extra_headers(mocker):
good_response = mock.Mock(spec=AWSResponse, status_code=200, headers={}, text='{}', content=b'{}')

send_mock.return_value = good_response
send_mock = mocker.patch('botocore.httpsession.URLLib3Session.send', return_value=good_response)

# return constant UUID
mocker.patch('uuid.uuid4', return_value=UUID('01FC4BDB-B223-4B86-88F4-DEE79B77F275'))
Expand Down

0 comments on commit a30a1bf

Please sign in to comment.