File size: 2,320 Bytes
310260a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
"""
Integration Tests for Agent Behavior

Tests agent handling of ambiguous input and error scenarios.
"""

import pytest

from tests.utils.agent_helpers import invoke_agent_with_message


@pytest.mark.integration
@pytest.mark.asyncio
async def test_agent_handles_ambiguous_user_input_gracefully(test_user):
    """
    Test: Agent handles ambiguous user input gracefully

    Verifies that agent responds appropriately to unclear requests.
    """
    # Execute with ambiguous input
    response = await invoke_agent_with_message(
        user_id=test_user.id,
        message="What can you do?"
    )

    # Assert agent responds
    assert "content" in response
    assert response["content"] is not None
    assert len(response["content"]) > 0


@pytest.mark.integration
@pytest.mark.asyncio
async def test_agent_handles_greeting_appropriately(test_user):
    """
    Test: Agent handles greeting appropriately

    Verifies that agent responds to greetings without calling tools.
    """
    # Execute with greeting
    response = await invoke_agent_with_message(
        user_id=test_user.id,
        message="Hello"
    )

    # Assert agent responds
    assert "content" in response
    assert len(response["content"]) > 0


@pytest.mark.integration
@pytest.mark.asyncio
async def test_agent_handles_unclear_task_request(test_user):
    """
    Test: Agent handles unclear task request

    Verifies that agent can handle vague task descriptions.
    """
    # Execute with vague request
    response = await invoke_agent_with_message(
        user_id=test_user.id,
        message="I need to do something later"
    )

    # Assert agent responds (may ask for clarification or create task)
    assert "content" in response
    assert len(response["content"]) > 0


@pytest.mark.integration
@pytest.mark.asyncio
async def test_agent_handles_invalid_task_id_gracefully(test_user):
    """
    Test: Agent handles invalid task ID gracefully

    Verifies that agent handles requests with non-existent task IDs.
    """
    # Execute with invalid task ID
    response = await invoke_agent_with_message(
        user_id=test_user.id,
        message="Mark task 99999 as complete"
    )

    # Assert agent responds with error or clarification
    assert "content" in response
    assert len(response["content"]) > 0