Skip to content

Commit

Permalink
remove tests relying on unauthorized access to Blinkist Premium
Browse files Browse the repository at this point in the history
  • Loading branch information
NicoWeio committed Oct 15, 2023
1 parent eb0d1e3 commit b65652d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 19 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/*
6 changes: 3 additions & 3 deletions tests/test_blinkist.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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)
Expand Down
18 changes: 7 additions & 11 deletions tests/test_book.py
Original file line number Diff line number Diff line change
@@ -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!"
Expand All @@ -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):
Expand Down
5 changes: 4 additions & 1 deletion tests/test_chapter.py
Original file line number Diff line number Diff line change
@@ -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']
Expand Down

0 comments on commit b65652d

Please sign in to comment.