Skip to content

Instantly share code, notes, and snippets.

@djberg96
Created May 12, 2021 19:11
Show Gist options
  • Save djberg96/4ae9a3e3193c7d708811ab4560337ab5 to your computer and use it in GitHub Desktop.
Save djberg96/4ae9a3e3193c7d708811ab4560337ab5 to your computer and use it in GitHub Desktop.
// Current error: use of package presenters without selector
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}
presenters = make([]openapi.ObjectReference, 2)
presenters[0] = presenters.PresentReference(service1.ID, service1)
presenters[1] = presenters.PresentReference(service2.ID, service2)
pd := openapi.PeerDependency{
Name: "valid_service_ids",
Services: presenters,
}
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).NotTo(BeEmpty(), "Expected associated services")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment