Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: move tvdb test to pytest #35

Merged
merged 1 commit into from
Feb 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ jobs:
- run: uv venv
- run: uv pip install -r requirements.txt -r requirements-dev.txt
- run: uv run pytest
env:
TVDB_API_KEY: ${{ secrets.TVDB_API_KEY }}
ruff:
runs-on: ubuntu-latest
steps:
Expand Down
23 changes: 0 additions & 23 deletions mona/tvdb.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/usr/bin/env python3
import asyncio
import os
from datetime import datetime

import httpx
Expand Down Expand Up @@ -88,24 +86,3 @@ async def get_season_extended(self, season_id: int) -> dict | None:
if response.status_code == 200:
return response.json().get("data")
return None


async def main():
tvdb = TVDB(os.environ["TVDB_API_KEY"])
token = await tvdb.login()
results = await tvdb.search("Yuyushiki")
series_id = results[0]["tvdb_id"]
series = await tvdb.get_series_extended(series_id)
artworks = await tvdb.get_series_artworks(series_id)
movie = await tvdb.get_movie_extended(16609)
assert token
assert results
assert series_id
assert series
assert artworks
assert movie
print("All tests passed!")


if __name__ == "__main__":
asyncio.run(main())
21 changes: 21 additions & 0 deletions tests/test_tvdb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import os

import pytest
from mona.tvdb import TVDB


@pytest.mark.asyncio
async def test_tvdb_api():
tvdb = TVDB(os.environ["TVDB_API_KEY"])
token = await tvdb.login()
results = await tvdb.search("Yuyushiki")
series_id = results[0]["tvdb_id"]
series = await tvdb.get_series_extended(series_id)
artworks = await tvdb.get_series_artworks(series_id)
movie = await tvdb.get_movie_extended(16609)
assert token
assert results
assert series_id
assert series
assert artworks
assert movie