summaryrefslogtreecommitdiff
path: root/internal/api/templates_test.go
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-03-07 23:54:32 +0000
committerPeter Stone <thepeterstone@gmail.com>2026-03-08 06:27:34 +0000
commitd422394021e4fb9ddb5405024468f03d962c5f5d (patch)
treee3d4ef9c9b49aee21cba553c33abbbbdb7359f72 /internal/api/templates_test.go
parentc6ce11e17af9a4b62bbbc082e5f13bb3a3b656a6 (diff)
feat(api): update template handlers to use AgentConfig
Diffstat (limited to 'internal/api/templates_test.go')
-rw-r--r--internal/api/templates_test.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/internal/api/templates_test.go b/internal/api/templates_test.go
index bbcfc87..474c5d4 100644
--- a/internal/api/templates_test.go
+++ b/internal/api/templates_test.go
@@ -34,7 +34,8 @@ func TestCreateTemplate_Success(t *testing.T) {
payload := `{
"name": "Go: Run Tests",
"description": "Run the full test suite with race detector",
- "claude": {
+ "agent": {
+ "type": "claude",
"model": "sonnet",
"instructions": "Run go test -race ./...",
"max_budget_usd": 0.50,
@@ -65,7 +66,7 @@ func TestCreateTemplate_Success(t *testing.T) {
func TestGetTemplate_AfterCreate(t *testing.T) {
srv, _ := testServer(t)
- payload := `{"name": "Fetch Me", "claude": {"instructions": "do thing", "model": "haiku"}}`
+ payload := `{"name": "Fetch Me", "agent": {"type": "claude", "instructions": "do thing", "model": "haiku"}}`
req := httptest.NewRequest("POST", "/api/templates", bytes.NewBufferString(payload))
w := httptest.NewRecorder()
srv.Handler().ServeHTTP(w, req)
@@ -107,14 +108,14 @@ func TestGetTemplate_NotFound(t *testing.T) {
func TestUpdateTemplate(t *testing.T) {
srv, _ := testServer(t)
- payload := `{"name": "Original Name", "claude": {"instructions": "original"}}`
+ payload := `{"name": "Original Name", "agent": {"type": "claude", "instructions": "original"}}`
req := httptest.NewRequest("POST", "/api/templates", bytes.NewBufferString(payload))
w := httptest.NewRecorder()
srv.Handler().ServeHTTP(w, req)
var created storage.Template
json.NewDecoder(w.Body).Decode(&created)
- update := `{"name": "Updated Name", "claude": {"instructions": "updated"}}`
+ update := `{"name": "Updated Name", "agent": {"type": "claude", "instructions": "updated"}}`
req2 := httptest.NewRequest("PUT", fmt.Sprintf("/api/templates/%s", created.ID), bytes.NewBufferString(update))
w2 := httptest.NewRecorder()
srv.Handler().ServeHTTP(w2, req2)
@@ -132,7 +133,7 @@ func TestUpdateTemplate(t *testing.T) {
func TestUpdateTemplate_NotFound(t *testing.T) {
srv, _ := testServer(t)
- update := `{"name": "Ghost", "claude": {"instructions": "x"}}`
+ update := `{"name": "Ghost", "agent": {"type": "claude", "instructions": "x"}}`
req := httptest.NewRequest("PUT", "/api/templates/nonexistent", bytes.NewBufferString(update))
w := httptest.NewRecorder()
srv.Handler().ServeHTTP(w, req)
@@ -145,7 +146,7 @@ func TestUpdateTemplate_NotFound(t *testing.T) {
func TestDeleteTemplate(t *testing.T) {
srv, _ := testServer(t)
- payload := `{"name": "To Delete", "claude": {"instructions": "bye"}}`
+ payload := `{"name": "To Delete", "agent": {"type": "claude", "instructions": "bye"}}`
req := httptest.NewRequest("POST", "/api/templates", bytes.NewBufferString(payload))
w := httptest.NewRecorder()
srv.Handler().ServeHTTP(w, req)