35 lines
977 B
Python
35 lines
977 B
Python
import pytest
|
|
import tempfile
|
|
from pathlib import Path
|
|
from src import beads_client
|
|
|
|
def test_beads_init_and_query(tmp_path: Path):
|
|
# Initialize a mock beads client in the temp directory
|
|
client = beads_client.BeadsClient(working_dir=tmp_path)
|
|
|
|
# Mocking initialization for the test
|
|
client.init_repo()
|
|
assert client.is_initialized()
|
|
|
|
# Create a bead
|
|
bead_id = client.create_bead(title="Test Bead", description="Test Description")
|
|
assert bead_id is not None
|
|
|
|
# Query beads
|
|
beads = client.list_beads()
|
|
assert len(beads) == 1
|
|
assert beads[0].id == bead_id
|
|
assert beads[0].title == "Test Bead"
|
|
assert beads[0].status == "active"
|
|
|
|
# Update bead status
|
|
success = client.update_bead(bead_id, "completed")
|
|
assert success
|
|
|
|
# Verify update
|
|
beads = client.list_beads()
|
|
assert beads[0].status == "completed"
|
|
|
|
# Test non-existent bead
|
|
assert not client.update_bead("bead-999", "failed")
|