Skip to content

Instantly share code, notes, and snippets.

@djberg96
Created May 12, 2021 18:45
Show Gist options
  • Select an option

  • Save djberg96/8e1a2b40ceda26a3d66aa38f142d0e2d to your computer and use it in GitHub Desktop.

Select an option

Save djberg96/8e1a2b40ceda26a3d66aa38f142d0e2d to your computer and use it in GitHub Desktop.
// Current error: cannot use services (type []openapi.Service) as type []openapi.ObjectReference in field value
func TestPeerDependencyPostWithValidServiceIds(t *testing.T){
h, client := test.RegisterIntegration(t)
account := h.NewRandAccount()
ctx := h.NewAuthenticatedContext(account)
service_uuid1 := h.NewUUID()
service_uuid2 := h.NewUUID()
service1 := h.NewService(service_uuid1, h.NewApplication(h.NewUUID(), h.NewApplicationGroup(h.NewUUID())))
service2 := h.NewService(service_uuid2, h.NewApplication(h.NewUUID(), h.NewApplicationGroup(h.NewUUID())))
services := make([]openapi.Service, 2)
services[0] = openapi.Service{Id: service_uuid1}
services[1] = openapi.Service{Id: service_uuid2}
pd := openapi.PeerDependency{
Name: "valid_service_ids",
Services: services,
}
peerDependency, resp, err := client.DefaultApi.ApiStatusBoardV1PeerDependenciesPost(ctx).PeerDependency(pd).Execute()
Expect(err).NotTo(HaveOccurred(), "Error posting object: %v", err)
Expect(resp.StatusCode).To(Equal(http.StatusCreated))
Expect(peerDependency.Id).NotTo(BeEmpty(), "Expected ID assigned on creation")
Expect(peerDependency.Name).To(Equal(pd.Name), "name mismatch")
Expect(peerDependency.Metadata).To(Equal(pd.Metadata), "metadata mismatch")
Expect(peerDependency.Kind).To(Equal("PeerDependency"))
Expect(peerDependency.Href).To(Equal(fmt.Sprintf("/api/status-board/v1/peer_dependencies/%s", peerDependency.Id)))
Expect(peerDependency.Services).To(Equal(service1, service2))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment