MCPcopy Create free account
hub / github.com/livebud/bud / TestJSONCreate500

Function TestJSONCreate500

framework/controller/controller_test.go:491–518  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

489}
490
491func TestJSONCreate500(t *testing.T) {
492 is := is.New(t)
493 ctx := context.Background()
494 dir := t.TempDir()
495 td := testdir.New(dir)
496 td.Files["controller/controller.go"] = `
497 package controller
498 import "errors"
499 type Controller struct {}
500 func (c *Controller) Create() (string, error) {
501 return "", errors.New("Not implemented yet")
502 }
503 `
504 is.NoErr(td.Write(ctx))
505 cli := testcli.New(dir)
506 app, err := cli.Start(ctx, "run")
507 is.NoErr(err)
508 defer app.Close()
509 res, err := app.PostJSON("/", nil)
510 is.NoErr(err)
511 is.NoErr(res.Diff(`
512 HTTP/1.1 500 Internal Server Error
513 Content-Type: application/json
514
515 {"error":"Not implemented yet"}
516 `))
517 is.NoErr(app.Close())
518}
519
520func TestDependencyHoist(t *testing.T) {
521 is := is.New(t)

Callers

nothing calls this directly

Calls 9

NewFunction · 0.92
NewFunction · 0.92
NewFunction · 0.92
NoErrMethod · 0.80
PostJSONMethod · 0.80
DiffMethod · 0.80
CloseMethod · 0.65
WriteMethod · 0.45
StartMethod · 0.45

Tested by

no test coverage detected