import pytest
from tests.integration.conftest import send_command
def test_connection_smoke(real_blender_connection):
"""
Basic smoke test to verify we can connect and get scene info.
"""
response = send_command(real_blender_connection, "get_scene_info")
assert response["status"] == "success"
assert "result" in response
assert "name" in response["result"]
def test_execute_code_smoke(real_blender_connection):
"""
Verify we can execute Python code in Blender.
"""
code = "import bpy; bpy.context.scene['test_prop'] = 'hello_world'"
response = send_command(real_blender_connection, "execute_code", {"code": code})
assert response["status"] == "success"
# Verify it actually happened by reading it back
check_code = "return_value = bpy.context.scene.get('test_prop', 'not_found')"
# Note: execute_code doesn't return values directly unless we modify the handler
# But let's check if we can get object info or something that changed
# Alternatively, create an object and check if it exists
create_code = "bpy.ops.mesh.primitive_cube_add(size=2, enter_editmode=False, align='WORLD', location=(0, 0, 0))"
send_command(real_blender_connection, "execute_code", {"code": create_code})
# Get scene info again to see if object count increased
response = send_command(real_blender_connection, "get_scene_info")
objects = response["result"].get("objects", [])
cube_found = any(obj["name"].startswith("Cube") for obj in objects)
assert cube_found, "Cube created via execute_code should be visible in scene info"