MCPcopy Index your code
hub / github.com/coder/coder / TestHandleAction_UnknownAction

Function TestHandleAction_UnknownAction

agent/x/agentdesktop/api_test.go:444–466  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

442}
443
444func TestHandleAction_UnknownAction(t *testing.T) {
445 t.Parallel()
446
447 logger := slogtest.Make(t, nil)
448 fake := &fakeDesktop{
449 startCfg: agentdesktop.DisplayConfig{Width: 1920, Height: 1080},
450 }
451 api := agentdesktop.NewAPI(logger, fake, nil)
452 defer api.Close()
453
454 body := agentdesktop.DesktopAction{Action: "explode"}
455 b, err := json.Marshal(body)
456 require.NoError(t, err)
457
458 rr := httptest.NewRecorder()
459 req := httptest.NewRequest(http.MethodPost, "/action", bytes.NewReader(b))
460 req.Header.Set("Content-Type", "application/json")
461
462 handler := api.Routes()
463 handler.ServeHTTP(rr, req)
464
465 assert.Equal(t, http.StatusBadRequest, rr.Code)
466}
467
468func TestHandleAction_KeyAction(t *testing.T) {
469 t.Parallel()

Callers

nothing calls this directly

Calls 7

CloseMethod · 0.95
RoutesMethod · 0.95
NewAPIFunction · 0.92
SetMethod · 0.65
MarshalMethod · 0.45
ServeHTTPMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected