-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement of logic for the only_n_last_entities
- Loading branch information
Showing
4 changed files
with
47 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import unittest | ||
|
||
from podcast_downloader.rss import only_last_n_entities | ||
from commons import rss_entity_generator | ||
|
||
|
||
class TestOnlyNLastRSSEntity(unittest.TestCase): | ||
def test_get_only_last_n_rss_entities_happy_path(self): | ||
# Assign | ||
entity_1, entity_2, entity_3, entity_4, entity_5 = rss_entity_generator(limit=5) | ||
|
||
rss_entities = [entity_1, entity_2, entity_3, entity_4, entity_5] | ||
expected = [entity_1, entity_2] | ||
|
||
# Act | ||
result = list(only_last_n_entities(2, rss_entities)) | ||
|
||
# Assert | ||
self.assertSequenceEqual( | ||
result, expected, "Only the last entity should be return as result" | ||
) | ||
|
||
def test_get_only_last_n_rss_entities_less_than_required(self): | ||
# Assign | ||
entity_1 = rss_entity_generator(limit=1) | ||
|
||
rss_entities = [entity_1] | ||
expected = [entity_1] | ||
|
||
# Act | ||
result = list(only_last_n_entities(2, rss_entities)) | ||
|
||
# Assert | ||
self.assertSequenceEqual( | ||
result, expected, "Only the last entity should be return as result" | ||
) |