MCPcopy Create free account
hub / github.com/convox/rack / TestBuildCreateUpload

Function TestBuildCreateUpload

sdk/compact_test.go:59–87  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

57}
58
59func TestBuildCreateUpload(t *testing.T) {
60 app := "app1"
61 build := structs.Build{
62 Id: "1",
63 App: app,
64 }
65
66 s := stdapi.New("api", "api")
67 s.Route("POST", fmt.Sprintf("/apps/%s/builds", app), func(c *stdapi.Context) error {
68 require.Equal(t, "convox", c.Form("description"))
69 require.Equal(t, "true", c.Form("cache"))
70
71 fp, _, err := c.Request().FormFile("source")
72 require.NoError(t, err)
73 b, err := io.ReadAll(fp)
74 require.NoError(t, err)
75 require.Equal(t, "test", string(b))
76
77 return c.RenderJSON(build)
78 })
79
80 testServer(t, s, func(c *sdk.Client) {
81 got, err := c.BuildCreateUpload(app, bytes.NewReader([]byte("test")), structs.BuildCreateOptions{
82 Description: options.String("convox"),
83 })
84 require.NoError(t, err)
85 require.Equal(t, &build, got)
86 })
87}
88
89func TestBuildImportMultipart(t *testing.T) {
90 app := "app1"

Callers

nothing calls this directly

Calls 4

StringFunction · 0.92
RequestMethod · 0.80
testServerFunction · 0.70
BuildCreateUploadMethod · 0.65

Tested by

no test coverage detected