From 203befcc27c262a8c08e1b815568504f0cc75eb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20P=C5=82ocki?= Date: Tue, 16 Jan 2024 22:39:50 +0100 Subject: [PATCH] Add the fill-up date method --- e2e/test_sample.py | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/e2e/test_sample.py b/e2e/test_sample.py index f46a215..ae6a376 100644 --- a/e2e/test_sample.py +++ b/e2e/test_sample.py @@ -90,19 +90,17 @@ def add_entry( return self def __fill_up_dates(self): - self.metadata = [ - ( - file_name, - title, - description, - datetime.datetime( - 2014, 7, 10, 2, 43, 55, 230107, tzinfo=datetime.timezone.utc - ) - if published_date == None - else published_date, - ) - for file_name, title, description, published_date in self.metadata - ] + result = [] + previous = datetime.datetime.now(datetime.timezone.utc) - datetime.timedelta( + days=random.randrange(3, 5) + ) + + while self.metadata: + metadatum = self.metadata.pop() + previous -= datetime.timedelta(days=random.randrange(2, 6)) + result.append((metadatum[0], metadatum[1], metadatum[2], previous)) + + self.metadata = reversed(result) def build(self): self.__fill_up_dates()