Exemplo n.º 1
0
    def test_write_dispatcher_write_only(self) -> None:
        self.dispatcher = wallet_database.SqliteWriteDispatcher(self.db_context)
        self.dispatcher._writer_loop_event.wait()

        _write_callback_called = False
        def _write_callback(conn):
            nonlocal _write_callback_called
            _write_callback_called = True

        self.dispatcher.put(WriteEntryType(_write_callback, None, 0))
        self.dispatcher.stop()

        assert _write_callback_called
Exemplo n.º 2
0
    def test_write_dispatcher_to_completion(self) -> None:
        self.dispatcher = wallet_database.SqliteWriteDispatcher(self.db_context)
        self.dispatcher._writer_loop_event.wait()

        _completion_callback_called = False
        def _completion_callback(success: bool):
            nonlocal _completion_callback_called
            _completion_callback_called = True

        _write_callback_called = False
        def _write_callback(conn):
            nonlocal _write_callback_called
            _write_callback_called = True

        self.dispatcher.put(WriteEntryType(_write_callback, _completion_callback, 0))
        self.dispatcher.stop()

        assert _write_callback_called
        assert _completion_callback_called