It("clears out existing saved target credentials", func() {
				test_helpers.ExecuteCommandWithArgs(targetCommand, []string{"myapi.com"})

				Expect(fakeTargetVerifier.VerifyTargetCallCount()).To(Equal(1))
				Expect(fakeTargetVerifier.VerifyTargetArgsForCall(0)).To(Equal("http://receptor.myapi.com"))
			})

			It("saves the new blob store target", func() {
				fakeBlobStoreVerifier.VerifyReturns(true, nil)

				test_helpers.ExecuteCommandWithArgs(targetCommand, []string{"myapi.com"})

				Expect(fakeBlobStoreVerifier.VerifyCallCount()).To(Equal(1))

				config := fakeBlobStoreVerifier.VerifyArgsForCall(0)
				blobStoreConfig := config.BlobStore()
				Expect(blobStoreConfig).To(Equal(config_package.BlobStoreConfig{
					Host: "myapi.com",
					Port: "8444",
				}))

				newConfig := config_package.New(configPersister)
				Expect(newConfig.Load()).To(Succeed())
				Expect(newConfig.BlobStore()).To(Equal(config_package.BlobStoreConfig{
					Host: "myapi.com",
					Port: "8444",
				}))
			})

			Context("when the blob store requires authorization", func() {
Ejemplo n.º 2
0
			})

			It("clears out existing saved target credentials", func() {
				test_helpers.ExecuteCommandWithArgs(targetCommand, []string{"myapi.com"})

				Expect(fakeTargetVerifier.VerifyTargetCallCount()).To(Equal(1))
				Expect(fakeTargetVerifier.VerifyTargetArgsForCall(0)).To(Equal("http://receptor.myapi.com"))
			})

			It("saves the new blob store target", func() {
				fakeBlobStoreVerifier.VerifyReturns(true, nil)

				test_helpers.ExecuteCommandWithArgs(targetCommand, []string{"myapi.com"})

				Expect(fakeBlobStoreVerifier.VerifyCallCount()).To(Equal(1))
				Expect(fakeBlobStoreVerifier.VerifyArgsForCall(0)).To(Equal(dav_blob_store.Config{
					Host: "myapi.com",
					Port: "8444",
				}))

				newConfig := config_package.New(configPersister)
				Expect(newConfig.Load()).To(Succeed())
				Expect(newConfig.BlobStore()).To(Equal(dav_blob_store.Config{
					Host: "myapi.com",
					Port: "8444",
				}))
			})

			Context("when the blob store requires authorization", func() {
				It("exits", func() {
					fakeBlobStoreVerifier.VerifyReturns(false, nil)