Skip to content

Instantly share code, notes, and snippets.

@djberg96
Created May 17, 2021 13:42
Show Gist options
  • Save djberg96/a42e9d11319672241f9af07043e21c2d to your computer and use it in GitHub Desktop.
Save djberg96/a42e9d11319672241f9af07043e21c2d to your computer and use it in GitHub Desktop.
func MakeService(h *test.Helper, ctx context.Context) (*api.Service) {
application_group := h.NewApplicationGroup(ctx, "some_application_group")
application := h.NewApplication(ctx, application_group, "some_application")
service := h.NewService(ctx, application, "some_service")
return service
}
func TestPeerDependencyPatchWithValidServiceIds(t *testing.T) {
h, client := test.RegisterIntegration(t)
account := h.NewRandAccount()
ctx := h.NewAuthenticatedContext(account)
service1 := MakeService(h, ctx)
service2 := MakeService(h, ctx)
pd := h.NewPeerDependency(ctx, h.NewUUID())
request := openapi.PeerDependencyPatchRequest{
ServiceIds: &[]string{service1.ID.String(), service2.ID.String()},
}
md := make(map[string]interface{})
md["pd_key"] = "pd_value"
request.SetName("new-peer-dependency-01")
request.SetMetadata(md)
peerDep, resp, err := client.DefaultApi.ApiStatusBoardV1PeerDependenciesIdPatch(ctx, pd.ID.String()).PeerDependencyPatchRequest(request).Execute()
Expect(err).NotTo(HaveOccurred())
Expect(resp.StatusCode).To(Equal(http.StatusAccepted))
Expect(peerDep.Id).To(Equal(pd.ID.String()))
Expect(peerDep.Name).To(Equal(*request.Name))
Expect(peerDep.Metadata).To(Equal(*request.Metadata))
Expect(peerDep.Services).NotTo(BeEmpty(), "Expected associated services")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment