Skip to content

Commit 4aacd6d

Browse files
committed
Parametrize whether to add GMT to tested formats
1 parent dd23d64 commit 4aacd6d

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/mock_vws/_mock_web_query_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ def validate_date_format(
302302
# We expect that more formats than this will be accepted.
303303
# These are the accepted ones we know of at the time of writing.
304304
known_accepted_formats = {
305-
'X'
305+
'%a, %d %b %Y %H:%M:%S GMT',
306306
}
307307

308308
try:

tests/mock_vws/test_query.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1621,17 +1621,25 @@ class TestDateFormats:
16211621
"""
16221622

16231623
@pytest.mark.parametrize('datetime_format', [
1624+
'%a, %b %d %H:%M:%S %Y',
16241625
'%a %b %d %H:%M:%S %Y',
1626+
'%a, %d %b %Y %H:%M:%S',
1627+
'%a %d %b %Y %H:%M:%S',
16251628
])
1629+
@pytest.mark.parametrize('include_tz', [True, False])
16261630
def test_date_formats(
16271631
self,
16281632
high_quality_image: io.BytesIO,
16291633
vuforia_database_keys: VuforiaDatabaseKeys,
16301634
datetime_format: str,
1635+
include_tz: bool,
16311636
) -> None:
16321637
image_content = high_quality_image.getvalue()
16331638
body = {'image': ('image.jpeg', image_content, 'image/jpeg')}
16341639

1640+
if include_tz:
1641+
datetime_format += ' GMT'
1642+
16351643
gmt = pytz.timezone('GMT')
16361644
now = datetime.datetime.now(tz=gmt)
16371645
date = now.strftime(datetime_format)

0 commit comments

Comments
 (0)