Skip to content

Commit

Permalink
E2E: make test test_download_from_n_days_from_feed_behavior more reli…
Browse files Browse the repository at this point in the history
…able
  • Loading branch information
dplocki committed Feb 2, 2024
1 parent 3195c16 commit 5f5cd28
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions e2e/fixures.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ def __fill_up_dates(self):
metadatum = self.metadata.pop()
if metadatum[self.PUBLISHED_DATE_INDEX] != None:
previous = metadatum[self.PUBLISHED_DATE_INDEX]
continue
else:
previous -= datetime.timedelta(days=random.randrange(2, 6))

previous -= datetime.timedelta(days=random.randrange(2, 6))
result.append(
(metadatum[0], metadatum[1], metadatum[2], previous, metadatum[4])
)

self.metadata = reversed(result)
self.metadata = result[::-1]

def __build_rss(self):
fg = FeedGenerator()
Expand Down
4 changes: 2 additions & 2 deletions e2e/test_simple_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def test_download_from_n_days_from_feed_behavior(

metadata = []
previous = datetime.datetime.now(datetime.timezone.utc) - datetime.timedelta(days=1)
for _ in range(generate_random_int()):
for _ in range(random.randrange(7, 13)):
metadata.append((generate_random_mp3_file(), previous))
previous -= datetime.timedelta(days=1)

Expand All @@ -183,5 +183,5 @@ def test_download_from_n_days_from_feed_behavior(
# Act
run_podcast_downloader()
podcast_directory.is_containing_only(
[m[0].lower() for m in metadata[:-n_days_number]]
[m[0].lower() for m in metadata[-n_days_number:]]
)

0 comments on commit 5f5cd28

Please sign in to comment.