示例#1
0
			`{
					"artifact": "mouse",
					"from": "local_location",
					"to": "web_location",
					"user": "******"
			}`,
			models.WrapAction(&models.UploadAction{
				Artifact: "mouse",
				From:     "local_location",
				To:       "web_location",
				User:     "******",
			}),
		)

		Describe("Validate", func() {
			var uploadAction *models.UploadAction

			Context("when the action has 'from', 'to', and 'user' specified", func() {
				It("is valid", func() {
					uploadAction = &models.UploadAction{
						To:   "web_location",
						From: "local_location",
						User: "******",
					}

					err := uploadAction.Validate()
					Expect(err).NotTo(HaveOccurred())
				})
			})

			for _, testCase := range []ValidatorErrorCase{
示例#2
0
	stderrBuffer := gbytes.NewBuffer()
	fakeStreamer.StdoutReturns(stdoutBuffer)
	fakeStreamer.StderrReturns(stderrBuffer)

	return fakeStreamer
}

var _ = Describe("UploadStep", func() {
	var (
		step   steps.Step
		result chan error

		uploadAction    *models.UploadAction
		uploader        Uploader.Uploader
		tempDir         string
		gardenClient    *fakes.FakeGardenClient
		logger          *lagertest.TestLogger
		compressor      Compressor.Compressor
		fakeStreamer    *fake_log_streamer.FakeLogStreamer
		currentUser     *user.User
		uploadTarget    *httptest.Server
		uploadedPayload []byte
	)

	BeforeEach(func() {
		var err error

		result = make(chan error)

		uploadTarget = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
			var err error