예제 #1
0
		By("Verifying task appears in completed tasks")
		var completedTasks []wl.Task
		Eventually(func() bool {
			// It is statistically probable that one of the lists will
			// be deleted, so we ignore error here.
			completedTasks, _ = client.CompletedTasks(showCompletedTasks)
			return taskContains(completedTasks, newTask)
		}).Should(BeTrue())
	})

	It("can update tasks", func() {
		By("Setting properties")
		newTask.Starred = true
		newTask.Completed = true
		newTask.RecurrenceType = "week"
		newTask.RecurrenceCount = 2

		By("Updating task")
		var t wl.Task
		Eventually(func() error {
			t, err = client.UpdateTask(newTask)
			return err
		}).Should(Succeed())
		newTask = t

		By("Getting task again")
		var taskAgain wl.Task
		Eventually(func() error {
			taskAgain, err = client.Task(newTask.ID)
			return err
		}).Should(Succeed())
예제 #2
0
						"X-Access-Token": []string{dummyAccessToken},
						"X-Client-ID":    []string{dummyClientID},
					}),
					ghttp.VerifyJSONRepresenting(expectedTaskUpdateConfig),
					ghttp.RespondWithJSONEncoded(http.StatusOK, expectedTask),
				),
			)
		})

		Context("when recurrenceType is not provided", func() {
			BeforeEach(func() {
				task.RecurrenceType = ""
			})

			It("does not allow recurrenceCount to be non-zero", func() {
				task.RecurrenceCount = 1
				_, err := client.UpdateTask(task)

				Expect(err).To(HaveOccurred())
				Expect(err.Error()).To(ContainSubstring("recurrenceCount"))
			})
		})

		Context("when recurrenceCount is zero", func() {
			BeforeEach(func() {
				task.RecurrenceCount = 0
			})

			It("does not allow recurrenceType to be provided", func() {
				task.RecurrenceType = "day"
				_, err := client.UpdateTask(task)