CreatedAt: createdAt, Result: `{ "buildpack_key":"buildpack-key", "detected_buildpack":"Some Buildpack", "execution_metadata":"{\"start_command\":\"./some-start-command\"}", "detected_start_command":{"web":"./some-start-command"} }`, Annotation: string(annotationJson), } handler.StagingComplete(responseRecorder, postTask(taskResponse)) }) It("passes the task response to the matching response builder", func() { Eventually(fakeBackend.BuildStagingResponseCallCount()).Should(Equal(1)) Expect(fakeBackend.BuildStagingResponseArgsForCall(0)).To(Equal(taskResponse)) }) Context("when the guid in the url does not match the task guid", func() { BeforeEach(func() { taskJSON, err := json.Marshal(taskResponse) Expect(err).NotTo(HaveOccurred()) req, err := http.NewRequest("POST", "/v1/staging/an-invalid-guid/completed", bytes.NewReader(taskJSON)) Expect(err).NotTo(HaveOccurred()) req.Form = url.Values{":staging_guid": {"an-invalid-guid"}} handler.StagingComplete(responseRecorder, req) })