def tester(start, end): random_metadata['start'] = Metadata.normalize_date(start) random_metadata['end'] = Metadata.normalize_date(end) r = { 'records': [{ 'url': 's3://bucket/file', 'metadata': random_metadata, }], 'next': None, } prepare_response(r, what=random_metadata['what'], start=random_metadata['start'], end=random_metadata['end']) l = list(archive.list(random_metadata['what'], start=start, end=end)) assert len(l) == 1 assert l[0]['url'] == 's3://bucket/file' assert l[0]['metadata'] == random_metadata
def test_normalize_garbage(basic_metadata): with pytest.raises(InvalidDatalakeMetadata): Metadata.normalize_date('bleeblaaablooo')
def test_normalize_date_with_datetime(basic_metadata): date = dateparse('2015-03-20T00:00:00Z') ms = Metadata.normalize_date(date) assert ms == 1426809600000