Skip to content

Commit

Permalink
E2E: Add test_default_behavior_fill_up_gaps
Browse files Browse the repository at this point in the history
  • Loading branch information
dplocki committed Feb 14, 2024
1 parent 38b99b5 commit 8ab0496
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions e2e/test_simple_configuration.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import datetime
from itertools import chain
from e2e.fixures import (
FeedBuilder,
PodcastDirectory,
Expand Down Expand Up @@ -80,6 +81,67 @@ def test_default_behavior_on_nonempty_podcast_directory(
podcast_directory.is_containing_only(expected_downloaded_files)


def test_default_behavior_fill_up_gaps(
feed: FeedBuilder,
use_config: Callable[[Dict], None],
podcast_directory: PodcastDirectory,
):
# Arrange
files_earliest_downloaded = call_n_times(generate_random_mp3_file)
downloaded_files_before_gap = call_n_times(generate_random_mp3_file)
the_gap_begin_file = generate_random_mp3_file()
files_in_the_gap = call_n_times(generate_random_mp3_file)
the_gap_end_file = generate_random_mp3_file()
downloaded_files_after_gap = call_n_times(generate_random_mp3_file)
files_to_download = call_n_times(generate_random_mp3_file)

for file_name in chain(
files_earliest_downloaded,
downloaded_files_before_gap,
[the_gap_begin_file],
files_in_the_gap,
[the_gap_end_file],
downloaded_files_after_gap,
files_to_download,
):
feed.add_entry(file_name)

for file_name in chain(
downloaded_files_before_gap,
[the_gap_begin_file, the_gap_end_file],
downloaded_files_after_gap,
):
podcast_directory.add_file(file_name)

use_config(
{
"podcasts": [
{
"path": podcast_directory.path(),
"rss_link": feed.get_feed_url(),
}
],
}
)

# Act
run_podcast_downloader()

# Assert
podcast_directory.is_containing_only(
[
file_name.lower()
for file_name in chain(
downloaded_files_before_gap,
[the_gap_begin_file],
[the_gap_end_file],
downloaded_files_after_gap,
files_to_download,
)
]
)


def test_download_all_from_feed_behavior(
feed: FeedBuilder,
use_config: Callable[[Dict], None],
Expand Down

0 comments on commit 8ab0496

Please sign in to comment.