path, _ = fakeBlobStore.UploadArgsForCall(1) Expect(path).To(Equal("drippy/result.json")) }) Context("when the blob bucket returns error(s)", func() { It("returns an error uploading the droplet file", func() { fakeBlobStore.UploadReturns(errors.New("some error")) err := dropletRunner.ImportDroplet("drippy", dropletPathArg, metadataPathArg) Expect(err).To(MatchError("some error")) }) It("returns an error uploading the metadata file", func() { fakeBlobStore.UploadStub = func(path string, contents io.ReadSeeker) error { if strings.HasSuffix(path, "result.json") { return errors.New("some error") } return nil } err := dropletRunner.ImportDroplet("drippy", dropletPathArg, metadataPathArg) Expect(err).To(MatchError("some error")) }) }) }) Context("when the droplet files do not exist", func() { It("returns an error opening the droplet file", func() { err := dropletRunner.ImportDroplet("drippy", "some/missing/droplet/path", metadataPathArg) Expect(reflect.TypeOf(err).String()).To(Equal("*os.PathError")) })