當前位置: 首頁>>代碼示例>>Golang>>正文


Golang FakeArtifactSource.StreamFileArgsForCall方法代碼示例

本文整理匯總了Golang中github.com/concourse/atc/exec/fakes.FakeArtifactSource.StreamFileArgsForCall方法的典型用法代碼示例。如果您正苦於以下問題:Golang FakeArtifactSource.StreamFileArgsForCall方法的具體用法?Golang FakeArtifactSource.StreamFileArgsForCall怎麽用?Golang FakeArtifactSource.StreamFileArgsForCall使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/concourse/atc/exec/fakes.FakeArtifactSource的用法示例。


在下文中一共展示了FakeArtifactSource.StreamFileArgsForCall方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1:

				repo.RegisterSource("some", fakeArtifactSource)
			})

			Context("when the artifact source provides a proper file", func() {
				var streamedOut *gbytes.Buffer

				BeforeEach(func() {
					marshalled, err := yaml.Marshal(someConfig)
					Ω(err).ShouldNot(HaveOccurred())

					streamedOut = gbytes.BufferWithBytes(marshalled)
					fakeArtifactSource.StreamFileReturns(streamedOut, nil)
				})

				It("fetches the file via the correct path", func() {
					Ω(fakeArtifactSource.StreamFileArgsForCall(0)).Should(Equal("build.yml"))
				})

				It("succeeds", func() {
					Ω(fetchErr).ShouldNot(HaveOccurred())
				})

				It("returns the unmarshalled config", func() {
					Ω(fetchedConfig).Should(Equal(someConfig))
				})

				It("closes the stream", func() {
					Ω(streamedOut.Closed()).Should(BeTrue())
				})
			})
開發者ID:utako,項目名稱:atc,代碼行數:30,代碼來源:config_source_test.go

示例2:

				})

				Context("from a path referring to a source", func() {
					var outStream io.ReadCloser

					BeforeEach(func() {
						path = "first-source/foo"

						outStream = gbytes.NewBuffer()
						firstSource.StreamFileReturns(outStream, nil)
					})

					It("streams out from the source", func() {
						Ω(stream).Should(Equal(outStream))

						Ω(firstSource.StreamFileArgsForCall(0)).Should(Equal("foo"))
					})

					Context("when streaming out from the source fails", func() {
						disaster := errors.New("nope")

						BeforeEach(func() {
							firstSource.StreamFileReturns(nil, disaster)
						})

						It("returns the error", func() {
							Ω(streamErr).Should(Equal(disaster))
						})
					})
				})
			})
開發者ID:utako,項目名稱:atc,代碼行數:31,代碼來源:source_repository_test.go

示例3:

				})

				Context("from a path referring to a source", func() {
					var outStream io.ReadCloser

					BeforeEach(func() {
						path = "first-source/foo"

						outStream = gbytes.NewBuffer()
						firstSource.StreamFileReturns(outStream, nil)
					})

					It("streams out from the source", func() {
						Expect(stream).To(Equal(outStream))

						Expect(firstSource.StreamFileArgsForCall(0)).To(Equal("foo"))
					})

					Context("when streaming out from the source fails", func() {
						disaster := errors.New("nope")

						BeforeEach(func() {
							firstSource.StreamFileReturns(nil, disaster)
						})

						It("returns the error", func() {
							Expect(streamErr).To(Equal(disaster))
						})
					})
				})
			})
開發者ID:ACPK,項目名稱:atc,代碼行數:31,代碼來源:source_repository_test.go

示例4:

				repo.RegisterSource("some", fakeArtifactSource)
			})

			Context("when the artifact source provides a proper file", func() {
				var streamedOut *gbytes.Buffer

				BeforeEach(func() {
					marshalled, err := yaml.Marshal(someConfig)
					Expect(err).NotTo(HaveOccurred())

					streamedOut = gbytes.BufferWithBytes(marshalled)
					fakeArtifactSource.StreamFileReturns(streamedOut, nil)
				})

				It("fetches the file via the correct path", func() {
					Expect(fakeArtifactSource.StreamFileArgsForCall(0)).To(Equal("build.yml"))
				})

				It("succeeds", func() {
					Expect(fetchErr).NotTo(HaveOccurred())
				})

				It("returns the unmarshalled config", func() {
					Expect(fetchedConfig).To(Equal(someConfig))
				})

				It("closes the stream", func() {
					Expect(streamedOut.Closed()).To(BeTrue())
				})
			})
開發者ID:ACPK,項目名稱:atc,代碼行數:30,代碼來源:config_source_test.go


注:本文中的github.com/concourse/atc/exec/fakes.FakeArtifactSource.StreamFileArgsForCall方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。