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

Function TestObjectStore

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

Source from the content-addressed store, hash-verified

109}
110
111func TestObjectStore(t *testing.T) {
112 testServer(t, func(c *stdsdk.Client, p *structs.MockProvider) {
113 o1 := fxObject
114 o2 := structs.Object{}
115 opts := structs.ObjectStoreOptions{}
116 ro := stdsdk.RequestOptions{
117 Body: strings.NewReader("data"),
118 }
119 p.On("ObjectStore", "app1", "path/object1.ext", mock.Anything, opts).Return(&o1, nil).Run(func(args mock.Arguments) {
120 data, err := io.ReadAll(args.Get(2).(io.Reader))
121 require.NoError(t, err)
122 require.Equal(t, "data", string(data))
123 })
124 err := c.Post("/apps/app1/objects/path/object1.ext", ro, &o2)
125 require.NoError(t, err)
126 require.Equal(t, o1, o2)
127 })
128}
129
130func TestObjectStoreError(t *testing.T) {
131 testServer(t, func(c *stdsdk.Client, p *structs.MockProvider) {

Callers

nothing calls this directly

Calls 4

PostMethod · 0.80
testServerFunction · 0.70
RunMethod · 0.65
GetMethod · 0.65

Tested by

no test coverage detected