def test_thread_deletion_with_short_ttl(db, default_account, default_namespace, marked_deleted_message, thread, folder): handler = DeleteHandler(account_id=default_account.id, namespace_id=default_namespace.id, provider_name=default_account.provider, uid_accessor=lambda m: m.imapuids, message_ttl=0, thread_ttl=120) delete_time = marked_deleted_message.deleted_at handler.check(delete_time + timedelta(seconds=1)) handler.gc_deleted_threads(delete_time + timedelta(seconds=1)) db.session.expire_all() with pytest.raises(ObjectDeletedError): marked_deleted_message.id thread.id assert thread.deleted_at is not None handler.check(thread.deleted_at + timedelta(seconds=121)) handler.gc_deleted_threads(thread.deleted_at + timedelta(seconds=121)) db.session.expire_all() with pytest.raises(ObjectDeletedError): marked_deleted_message.id with pytest.raises(ObjectDeletedError): thread.id
def test_thread_deletion_with_short_ttl(db, default_account, default_namespace, marked_deleted_message, thread, folder): handler = DeleteHandler( account_id=default_account.id, namespace_id=default_namespace.id, provider_name=default_account.provider, uid_accessor=lambda m: m.imapuids, message_ttl=0, thread_ttl=120, ) delete_time = marked_deleted_message.deleted_at handler.check(delete_time + timedelta(seconds=1)) handler.gc_deleted_threads(delete_time + timedelta(seconds=1)) db.session.expire_all() with pytest.raises(ObjectDeletedError): marked_deleted_message.id thread.id assert thread.deleted_at is not None handler.check(thread.deleted_at + timedelta(seconds=121)) handler.gc_deleted_threads(thread.deleted_at + timedelta(seconds=121)) db.session.expire_all() with pytest.raises(ObjectDeletedError): marked_deleted_message.id with pytest.raises(ObjectDeletedError): thread.id
def test_deletion_with_short_ttl(db, default_account, default_namespace, marked_deleted_message, thread, folder): handler = DeleteHandler(account_id=default_account.id, namespace_id=default_namespace.id, provider_name=default_account.provider, uid_accessor=lambda m: m.imapuids, message_ttl=0, thread_ttl=0) handler.check(marked_deleted_message.deleted_at + timedelta(seconds=1)) handler.gc_deleted_threads(thread.deleted_at + timedelta(seconds=1)) db.session.expire_all() # Check that objects were actually deleted with pytest.raises(ObjectDeletedError): marked_deleted_message.id with pytest.raises(ObjectDeletedError): thread.id