MCPcopy Index your code
hub / github.com/docker/docker-agent / TestServer_UpdateSessionTitle

Function TestServer_UpdateSessionTitle

pkg/server/server_test.go:175–203  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

173}
174
175func TestServer_UpdateSessionTitle(t *testing.T) {
176 t.Parallel()
177
178 ctx := t.Context()
179 store := session.NewInMemorySessionStore()
180 lnPath := startServerWithStore(t, ctx, prepareAgentsDir(t), store)
181
182 // Create a session first
183 createResp := httpDo(t, ctx, http.MethodPost, lnPath, "/api/sessions", map[string]any{})
184 var createdSession session.Session
185 unmarshal(t, createResp, &createdSession)
186 require.NotEmpty(t, createdSession.ID)
187
188 // Update the session title
189 newTitle := "My Custom Title"
190 updateResp := httpDo(t, ctx, http.MethodPatch, lnPath, "/api/sessions/"+createdSession.ID+"/title", api.UpdateSessionTitleRequest{Title: newTitle})
191 var titleResp api.UpdateSessionTitleResponse
192 unmarshal(t, updateResp, &titleResp)
193
194 assert.Equal(t, createdSession.ID, titleResp.ID)
195 assert.Equal(t, newTitle, titleResp.Title)
196
197 // Verify the session was updated in the store
198 getResp := httpGET(t, ctx, lnPath, "/api/sessions/"+createdSession.ID)
199 var sessionResp api.SessionResponse
200 unmarshal(t, getResp, &sessionResp)
201
202 assert.Equal(t, newTitle, sessionResp.Title)
203}
204
205// TestServer_ForkSession exercises the POST /api/sessions/:id/fork
206// endpoint end-to-end: a fork at the Nth user message must return a

Callers

nothing calls this directly

Calls 7

NewInMemorySessionStoreFunction · 0.92
startServerWithStoreFunction · 0.85
prepareAgentsDirFunction · 0.85
httpDoFunction · 0.85
unmarshalFunction · 0.85
httpGETFunction · 0.85
ContextMethod · 0.80

Tested by

no test coverage detected