Skip to content

Commit

Permalink
feat: Updated agents-api/agents_api/models/session
Browse files Browse the repository at this point in the history
  • Loading branch information
sweep-ai[bot] committed Apr 13, 2024
1 parent ddd39cc commit 018bfc0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions agents-api/agents_api/models/session/test_session_queries.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
"""
This module contains tests for session-related queries against the 'cozodb' database. It verifies the creation, retrieval, and deletion of session records as defined in the schema provided in agents-api/README.md.
"""
# Tests for session queries
from uuid import uuid4

Expand Down Expand Up @@ -28,6 +31,7 @@ def cozo_client(migrations_dir: str = "./migrations"):

@test("model: create session")
def _():
"""Test session creation with a valid session, user, agent, and developer IDs."""
client = cozo_client()
session_id = uuid4()
agent_id = uuid4()
Expand All @@ -46,6 +50,7 @@ def _():

@test("model: create session no user")
def _():
"""Test session creation without a user ID."""
client = cozo_client()
session_id = uuid4()
agent_id = uuid4()
Expand All @@ -63,6 +68,7 @@ def _():

@test("model: get session not exists")
def _():
"""Verify that querying a non-existent session returns an empty result."""
client = cozo_client()
session_id = uuid4()
developer_id = uuid4()
Expand All @@ -78,6 +84,7 @@ def _():

@test("model: get session exists")
def _():
"""Verify that a created session can be successfully retrieved."""
client = cozo_client()
session_id = uuid4()
agent_id = uuid4()
Expand All @@ -104,6 +111,7 @@ def _():

@test("model: get session data")
def _():
"""Test retrieval of session data for an existing session."""
# Setup client for user and agent
client = cozo_client()

Expand Down Expand Up @@ -152,6 +160,7 @@ def _():

@test("model: delete session")
def _():
"""Test the deletion of a session and verify it cannot be retrieved afterwards."""
# Setup client for user and agent
client = cozo_client()

Expand Down Expand Up @@ -215,6 +224,7 @@ def _():
agent_id = uuid4()
user_id = uuid4()

# Setup: Create a user, agent, and session for testing session data retrieval using get_session_data.
# Create a user
create_user_query(
user_id=user_id,
Expand Down

0 comments on commit 018bfc0

Please sign in to comment.