Small update to results time period test

Updated to ensure a child span element is available before running a
test to verify the correct time range for the result. Need to come up
with a better way of ensuring uniform results across multiple tests,
since otherwise periodic changes in the returned results can cause tests
to fail.
main
Ben Busby 2020-06-28 10:52:53 -06:00
parent 4e970a4796
commit 6ef7ab663a
1 changed files with 1 additions and 1 deletions

View File

@ -55,7 +55,7 @@ def test_recent_results(client):
result_divs = get_search_results(rv.data) result_divs = get_search_results(rv.data)
current_date = datetime.now() current_date = datetime.now()
for div in result_divs: for div in [_ for _ in result_divs if _.find('span')]:
date_span = div.find('span').decode_contents() date_span = div.find('span').decode_contents()
if not date_span or len(date_span) > 15 or len(date_span) < 7: if not date_span or len(date_span) > 15 or len(date_span) < 7:
continue continue