diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 47bd45b..79cbe0b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -58,10 +58,10 @@ jobs: - name: Test `--freedaily` run: | python main.py --freedaily /home/runner/Musik/Blinkist/ - # NOTE: The following should require a paid plan, but doesn't. Let's see for how much longer it works. - - name: Test `--book-slug` - run: | - python main.py --book-slug get-smart-en /home/runner/Musik/Blinkist/ + # NOTE: The following requires Blinkist Premium. + # - name: Test `--book-slug` + # run: | + # python main.py --book-slug get-smart-en /home/runner/Musik/Blinkist/ - name: Check the directory contents run: | ls -hl /home/runner/Musik/Blinkist/* diff --git a/tests/test_blinkist.py b/tests/test_blinkist.py index 5e73754..4d95da3 100644 --- a/tests/test_blinkist.py +++ b/tests/test_blinkist.py @@ -12,14 +12,14 @@ def test_get_free_daily(): def test_get_latest_books(): books = blinkist.get_latest_books() assert len(books) > 0 - assert len(books) <= 8 # NOTE: We use <= becauase search_books filters out non-book results. + assert len(books) <= 8 # NOTE: We use <= because search_books filters out non-book results. assert books[0].title def test_get_trending_books(): books = blinkist.get_trending_books() assert len(books) > 0 - assert len(books) <= 8 # NOTE: We use <= becauase search_books filters out non-book results. + assert len(books) <= 8 # NOTE: We use <= because search_books filters out non-book results. assert books[0].title @@ -38,7 +38,7 @@ def test_default(self): def test_limit(self): books = blinkist.search_books("smart", limit=5) - assert len(books) <= 5 # NOTE: We use <= becauase search_books filters out non-book results. + assert len(books) <= 5 # NOTE: We use <= because search_books filters out non-book results. def test_languages(self): books = blinkist.search_books("smart", limit=10) diff --git a/tests/test_book.py b/tests/test_book.py index bd26e55..d3c311b 100644 --- a/tests/test_book.py +++ b/tests/test_book.py @@ -1,17 +1,13 @@ -from blinkist.book import Book -from blinkist.chapter import Chapter - -# def test___init__(): - -# def test___repr__(): +import pytest -# def test___hash__(): - -# def test___eq__(): +from blinkist import blinkist +from blinkist.chapter import Chapter -book = Book.from_slug('get-smart-en') +# book = Book.from_slug('get-smart-en') +book = blinkist.get_free_daily('en') +@pytest.mark.skip(reason="Requires Blinkist Premium.") def test_from_slug(): # ↓ book-specific assert book.title == "Get Smart!" @@ -28,7 +24,7 @@ def test_chapters(): assert all(chapter.data['text'] for chapter in book.chapters) # ↓ book-specific - assert len(book.chapters) == 1+9+1 + # assert len(book.chapters) == 1+9+1 def test_download_cover(tmp_path): diff --git a/tests/test_chapter.py b/tests/test_chapter.py index 31d650a..92541d7 100644 --- a/tests/test_chapter.py +++ b/tests/test_chapter.py @@ -1,12 +1,15 @@ import pytest +from blinkist import blinkist from blinkist.book import Book from blinkist.chapter import Chapter -book = Book.from_slug('get-smart-en') +# book = Book.from_slug('get-smart-en') +book = blinkist.get_free_daily('en') chapter = book.chapters[0] +@pytest.mark.skip(reason="Requires Blinkist Premium.") def test_from_id(): chapter = Chapter.from_id(book, '58da6e44232de90004a6e66d') assert chapter.data['text']