Created
May 17, 2021 13:42
-
-
Save djberg96/a42e9d11319672241f9af07043e21c2d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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