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

Function TestSystemResourceCreate

sdk/methods_test.go:1297–1322  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1295}
1296
1297func TestSystemResourceCreate(t *testing.T) {
1298 rs := &structs.Resource{
1299 Name: "name",
1300 Parameters: map[string]string{"hello": "world"},
1301 Status: "status,omitempty",
1302 Type: "type",
1303 Url: "url",
1304 Apps: structs.Apps{{Name: "app1"}},
1305 }
1306 s := stdapi.New("api", "api")
1307 s.Route("POST", fmt.Sprintf("/resources"), func(c *stdapi.Context) error {
1308 require.Equal(t, rs.Type, c.Form("kind"))
1309 require.Equal(t, rs.Name, c.Form("name"))
1310 require.Equal(t, "hello=world", c.Form("parameters"))
1311 return c.RenderJSON(rs)
1312 })
1313
1314 testServer(t, s, func(c *sdk.Client) {
1315 got, err := c.SystemResourceCreate(rs.Type, structs.ResourceCreateOptions{
1316 Name: &rs.Name,
1317 Parameters: rs.Parameters,
1318 })
1319 require.NoError(t, err)
1320 require.Equal(t, rs, got)
1321 })
1322}
1323
1324func TestSystemResourceDelete(t *testing.T) {
1325 name := "rs1"

Callers

nothing calls this directly

Calls 2

testServerFunction · 0.70
SystemResourceCreateMethod · 0.65

Tested by

no test coverage detected