def test_ttl_add_message(chat_store_with_ttl):
    """Test that TTL is set when adding a message."""
    message = ChatMessage(content="Hello TTL Add")
    chat_store_with_ttl.add_message("TTLAddSession", message)

    # Get the raw item from DynamoDB to check TTL
    response = chat_store_with_ttl._table.get_item(Key={"SessionId": "TTLAddSession"})
    item = response["Item"]

    # Verify TTL attribute exists
    assert "TTL" in item

    # Verify TTL is set to a future time (now + 3600 seconds)
    current_time = int(time.time())
    assert item["TTL"] > current_time
    # Allow some buffer for test execution time
    assert item["TTL"] <= current_time + 3700
Test that TTL is set when adding a message.
llama-index-integrations/storage/chat_store/llama-index-storage-chat-store-dynamodb/tests/test_chat_store_dynamodb_chat_store.py