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

Function TestSystemResourceCreate

pkg/api/resource_test.go:72–92  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

70}
71
72func TestSystemResourceCreate(t *testing.T) {
73 testServer(t, func(c *stdsdk.Client, p *structs.MockProvider) {
74 r1 := fxResource
75 r2 := structs.Resource{}
76 opts := structs.ResourceCreateOptions{
77 Name: options.String("resource1"),
78 Parameters: map[string]string{"k1": "v1", "k2": "v2"},
79 }
80 ro := stdsdk.RequestOptions{
81 Params: stdsdk.Params{
82 "name": "resource1",
83 "kind": "type",
84 "parameters": "k1=v1&k2=v2",
85 },
86 }
87 p.On("SystemResourceCreate", "type", opts).Return(&r1, nil)
88 err := c.Post("/resources", ro, &r2)
89 require.NoError(t, err)
90 require.Equal(t, r1, r2)
91 })
92}
93
94func TestSystemResourceCreateError(t *testing.T) {
95 testServer(t, func(c *stdsdk.Client, p *structs.MockProvider) {

Callers

nothing calls this directly

Calls 3

StringFunction · 0.92
PostMethod · 0.80
testServerFunction · 0.70

Tested by

no test coverage detected