Example #1
0
def test_update_copy_status_emits_1_for_zero_files(mocker):
    from cozy.media.files import Files

    files = Files()
    spy = mocker.spy(files, "emit_event_main_thread")

    files._file_count = 0
    files._update_copy_status(1, 2, None)
    spy.assert_called_once_with("copy-progress", 1.0)
Example #2
0
 def configure_inject(self, binder):
     binder.bind_to_provider(SqliteDatabase, get_db)
     binder.bind("MainWindow", self.main_window)
     binder.bind_to_constructor(
         Gio.Settings, lambda: Gio.Settings("com.github.geigi.cozy"))
     binder.bind_to_constructor(ApplicationSettings,
                                lambda: ApplicationSettings())
     binder.bind_to_constructor(Settings, lambda: Settings())
     binder.bind_to_constructor("FilesystemMonitor",
                                lambda: FilesystemMonitor())
     binder.bind_to_constructor(OfflineCache, lambda: OfflineCache())
     binder.bind_to_constructor(Player, lambda: Player())
     binder.bind_to_constructor(Library, lambda: Library())
     binder.bind_to_constructor(LibraryViewModel,
                                lambda: LibraryViewModel())
     binder.bind_to_constructor(SearchViewModel, lambda: SearchViewModel())
     binder.bind_to_constructor(UISettings, lambda: UISettings())
     binder.bind_to_constructor(StorageBlockList,
                                lambda: StorageBlockList())
     binder.bind_to_constructor(Files, lambda: Files())
     binder.bind_to_constructor(BookDetailViewModel,
                                lambda: BookDetailViewModel())
     binder.bind_to_constructor(PlaybackControlViewModel,
                                lambda: PlaybackControlViewModel())
     binder.bind_to_constructor(HeaderbarViewModel,
                                lambda: HeaderbarViewModel())
     binder.bind_to_constructor(PlaybackSpeedViewModel,
                                lambda: PlaybackSpeedViewModel())
     binder.bind_to_constructor(SleepTimerViewModel,
                                lambda: SleepTimerViewModel())
Example #3
0
 def configure_inject(binder):
     binder.bind_to_provider(SqliteDatabase, get_db)
     binder.bind_to_constructor(
         Gio.Settings, lambda: Gio.Settings("com.github.geigi.cozy"))
     binder.bind_to_constructor(ApplicationSettings,
                                lambda: ApplicationSettings())
     binder.bind_to_constructor(Settings, lambda: Settings())
     binder.bind_to_constructor("FilesystemMonitor",
                                lambda: FilesystemMonitor())
     binder.bind_to_constructor(Library, lambda: Library())
     binder.bind_to_constructor(LibraryViewModel,
                                lambda: LibraryViewModel())
     binder.bind_to_constructor(SearchViewModel, lambda: SearchViewModel())
     binder.bind_to_constructor(UISettings, lambda: UISettings())
     binder.bind_to_constructor(StorageBlockList,
                                lambda: StorageBlockList())
     binder.bind_to_constructor(Files, lambda: Files())