everything working again after cleanup
This commit is contained in:
@@ -129,13 +129,22 @@ def test_get_recent_messages(
|
||||
) -> None:
|
||||
"""Test retrieving recent messages."""
|
||||
chat_db.add_message(
|
||||
message_id="msg-1", user_id="u1", username="alice", content="First",
|
||||
message_id="msg-1",
|
||||
user_id="u1",
|
||||
username="alice",
|
||||
content="First",
|
||||
)
|
||||
chat_db.add_message(
|
||||
message_id="msg-2", user_id="u2", username="bob", content="Second",
|
||||
message_id="msg-2",
|
||||
user_id="u2",
|
||||
username="bob",
|
||||
content="Second",
|
||||
)
|
||||
chat_db.add_message(
|
||||
message_id="msg-3", user_id="u1", username="alice", content="Third",
|
||||
message_id="msg-3",
|
||||
user_id="u1",
|
||||
username="alice",
|
||||
content="Third",
|
||||
)
|
||||
|
||||
messages = chat_db.get_recent_messages(limit=2)
|
||||
@@ -167,10 +176,16 @@ def test_clear_all_messages(
|
||||
) -> None:
|
||||
"""Test clearing all messages."""
|
||||
chat_db.add_message(
|
||||
message_id="msg-1", user_id="u1", username="alice", content="Hello",
|
||||
message_id="msg-1",
|
||||
user_id="u1",
|
||||
username="alice",
|
||||
content="Hello",
|
||||
)
|
||||
chat_db.add_message(
|
||||
message_id="msg-2", user_id="u2", username="bob", content="World",
|
||||
message_id="msg-2",
|
||||
user_id="u2",
|
||||
username="bob",
|
||||
content="World",
|
||||
)
|
||||
|
||||
chat_db.clear_all_messages()
|
||||
@@ -185,7 +200,10 @@ def test_get_user_history(
|
||||
) -> None:
|
||||
"""Test retrieving user message history."""
|
||||
chat_db.add_message(
|
||||
message_id="msg-1", user_id="u1", username="alice", content="User question",
|
||||
message_id="msg-1",
|
||||
user_id="u1",
|
||||
username="alice",
|
||||
content="User question",
|
||||
)
|
||||
chat_db.add_message(
|
||||
message_id="msg-1_response",
|
||||
@@ -422,7 +440,9 @@ def test_custom_bot_delete_with_error(
|
||||
) -> None:
|
||||
"""Test that delete_custom_bot returns False on error."""
|
||||
with patch.object(
|
||||
custom_bot_manager, "_initialize_custom_bots_table", side_effect=Exception("db error"), # noqa: E501
|
||||
custom_bot_manager,
|
||||
"_initialize_custom_bots_table",
|
||||
side_effect=Exception("db error"),
|
||||
):
|
||||
pass
|
||||
result = custom_bot_manager.delete_custom_bot("nonexistent")
|
||||
@@ -433,6 +453,7 @@ def test_database_get_database_singleton(temp_db_path: str) -> None:
|
||||
"""Test that get_database returns the same instance."""
|
||||
import vibe_bot.database as db_module
|
||||
from vibe_bot.database import ChatDatabase, get_database
|
||||
|
||||
db_module._chat_db = None
|
||||
|
||||
db1 = get_database()
|
||||
@@ -453,6 +474,7 @@ def test_database_init_creates_tables(temp_db_path: str) -> None:
|
||||
db.client.close()
|
||||
|
||||
import sqlite3
|
||||
|
||||
conn = sqlite3.connect(temp_db_path)
|
||||
cursor = conn.cursor()
|
||||
cursor.execute("SELECT name FROM sqlite_master WHERE type='table'")
|
||||
|
||||
Reference in New Issue
Block a user