def test_en_ebook_size_at_least_16_mb_info(): assert get_file_date_info('/static/pdfs/web_almanac_2019_en.pdf', 'size') > 16
def test_random_value_is_returned_as_none(): assert get_file_date_info('en/2019/index.html', 'rubbish') is None
def test_date_modified_is_larger_than_min_date(): date_modified = get_file_date_info('en/2019/index.html', 'date_modified') assert date_modified > MIN_DATE
def test_hash_is_returned_and_correct_format(): pattern = re.compile(r"^[0-9a-f]{32}$") hash = get_file_date_info('en/2019/index.html', 'hash') assert pattern.match(hash)
def test_date_modified_is_returned_and_correct_format(): pattern = re.compile(r"^20[0-9]{2}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3}Z$") date_modified = get_file_date_info('en/2019/index.html', 'date_modified') assert pattern.match(date_modified)