Skip to content

Commit a1a2e26

Browse files
committed
Progress towards test for exception
1 parent 3494068 commit a1a2e26

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/test_exceptions.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@
44

55
import io
66
import random
7+
from datetime import datetime, timedelta
78

89
import pytest
10+
import pytz
911
from mock_vws import MockVWS, States
1012
from PIL import Image
1113
from requests import codes
1214

15+
from freezegun import freeze_time
1316
from vws import VWS
1417
from vws.exceptions import (
1518
BadImage,
@@ -197,3 +200,14 @@ def test_metadata_too_large(
197200
)
198201

199202
assert exc.value.response.status_code == codes.UNPROCESSABLE_ENTITY
203+
204+
205+
def test_request_time_too_skewed(client: VWS) -> None:
206+
vws_max_time_skew = timedelta(minutes=5)
207+
leeway = timedelta(seconds=10)
208+
time_difference_from_now = vws_max_time_skew + leeway
209+
gmt = pytz.timezone('GMT')
210+
with freeze_time(datetime.now(tz=gmt) + time_difference_from_now):
211+
client.list_targets()
212+
# with pytest.raises(RequestTimeTooSkewed):
213+
# pass

0 commit comments

Comments
 (0)