-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f3e8699
commit 4479e7d
Showing
7 changed files
with
227 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from unittest.mock import patch | ||
|
||
import pytest | ||
|
||
from themoviedb import routes, schemas | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_episode_group_details(get_data, assert_data): | ||
data = get_data("tv_episode_groups/details") | ||
episode_group_id = 123 | ||
|
||
with patch("themoviedb.routes.base.ClientSession.request") as mocked: | ||
mocked.return_value.__aenter__.return_value.json.return_value = data | ||
episode_groups = await routes.EpisodeGroup(episode_group_id).details() | ||
mocked.assert_called_with( | ||
"GET", | ||
f"https://api.themoviedb.org/3/tv/episode_group/{episode_group_id}", | ||
params={ | ||
"api_key": "TEST_TMDB_KEY", | ||
"language": "en-US", | ||
"region": "US", | ||
"watch_region": "US", | ||
}, | ||
) | ||
|
||
assert isinstance(episode_groups, schemas.EpisodeGroup) | ||
assert assert_data(episode_groups, data) |
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# -*- coding: utf-8 -*- | ||
from themoviedb import schemas, utils | ||
from themoviedb.routes.base import Base | ||
|
||
|
||
class EpisodeGroup(Base): | ||
def __init__(self, episode_group_id: int, **kwargs) -> None: | ||
super().__init__(**kwargs) | ||
self.episode_group_id = episode_group_id | ||
|
||
async def details(self) -> schemas.EpisodeGroup: | ||
"""Get the details of a TV episode group. | ||
See more: https://developers.themoviedb.org/3/tv-episode-groups/get-tv-episode-group-details | ||
""" | ||
data = await self.request(f"tv/episode_group/{self.episode_group_id}") | ||
return utils.as_dataclass(schemas.EpisodeGroup, data) |
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