Changeset View
Changeset View
Standalone View
Standalone View
swh/web/tests/common/test_origin_save.py
Show First 20 Lines • Show All 370 Lines • ▼ Show 20 Lines | requests_mock.head( | ||||
}, | }, | ||||
) | ) | ||||
actual_result = origin_exists(url) | actual_result = origin_exists(url) | ||||
assert actual_result == OriginExistenceCheckInfo( | assert actual_result == OriginExistenceCheckInfo( | ||||
origin_url=url, | origin_url=url, | ||||
exists=True, | exists=True, | ||||
content_length=10, | content_length=10, | ||||
last_modified="Sun, 21 Aug 2011 16:26:32 GMT", | last_modified="2011-08-21T16:26:32", | ||||
) | |||||
def test_origin_exists_200_with_data_unexpected_date_format(requests_mock): | |||||
"""Existing origin should be ok, unexpected last modif time result in no time""" | |||||
url = "http://example.org/real-url2" | |||||
requests_mock.head( | |||||
ardumont: should mentioned as comment that the date is not in a expected parsable format thus the None… | |||||
url, status_code=200, headers={"last-modified": "Sun, 21 Aug 2021 16:26:32",}, | |||||
) | |||||
actual_result = origin_exists(url) | |||||
assert actual_result == OriginExistenceCheckInfo( | |||||
origin_url=url, exists=True, content_length=None, last_modified=None, | |||||
) | ) | ||||
@pytest.mark.django_db | @pytest.mark.django_db | ||||
@pytest.mark.parametrize("visit_status", ["created", "ongoing",]) | @pytest.mark.parametrize("visit_status", ["created", "ongoing",]) | ||||
def test_get_save_origin_requests_no_visit_date_found(mocker, visit_status): | def test_get_save_origin_requests_no_visit_date_found(mocker, visit_status): | ||||
"""Uneventful visits with failed visit status are marked as failed | """Uneventful visits with failed visit status are marked as failed | ||||
▲ Show 20 Lines • Show All 105 Lines • Show Last 20 Lines |
should mentioned as comment that the date is not in a expected parsable format thus the None below.