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

Function TestObjectFetch

pkg/api/object_test.go:56–69  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

54}
55
56func TestObjectFetch(t *testing.T) {
57 testServer(t, func(c *stdsdk.Client, p *structs.MockProvider) {
58 d1 := []byte("test")
59 r1 := io.NopCloser(bytes.NewReader(d1))
60 p.On("ObjectFetch", "app1", "path/object1.ext").Return(r1, nil)
61 res, err := c.GetStream("/apps/app1/objects/path/object1.ext", stdsdk.RequestOptions{})
62 require.NoError(t, err)
63 require.NotNil(t, res)
64 defer res.Body.Close()
65 d2, err := io.ReadAll(res.Body)
66 require.NoError(t, err)
67 require.Equal(t, d1, d2)
68 })
69}
70
71func TestObjectFetchError(t *testing.T) {
72 testServer(t, func(c *stdsdk.Client, p *structs.MockProvider) {

Callers

nothing calls this directly

Calls 2

testServerFunction · 0.70
CloseMethod · 0.45

Tested by

no test coverage detected