def test_loading_new_book_emits_changed_event(mocker): from cozy.media.player import Player mocker.patch("cozy.media.player.Player._rewind_in_book") library = inject.instance(Library) player = Player() spy = mocker.spy(player, "emit_event_main_thread") book = library.books[2] player._continue_book(book) spy.assert_has_calls(calls=[call("chapter-changed", book)])
def test_loading_new_book_loads_chapter_and_book(mocker): from cozy.media.player import Player mocker.patch("cozy.media.player.Player._rewind_in_book") library = inject.instance(Library) player = Player() book = library.books[0] player._continue_book(book) assert player._book == book assert player._book.current_chapter == book.current_chapter