コード例 #1
0
		Eventually(func() error {
			newList1, err = client.CreateList(newListTitle1)
			return err
		}).Should(Succeed())

		var newList2 wl.List
		Eventually(func() error {
			newList2, err = client.CreateList(newListTitle2)
			return err
		}).Should(Succeed())

		// We have to reorder the lists before they are present in the
		// returned response. This seems like a bug in Wunderlist API

		By("Reordering lists")
		var listPosition wl.Position

		for {
			Eventually(func() error {
				listPositions, err := client.ListPositions()
				listPosition = listPositions[0]
				return err
			}).Should(Succeed())

			listPosition.Values = []uint{newList1.ID, newList2.ID}

			listPosition, err = client.UpdateListPosition(listPosition)
			if err != nil {
				if strings.Contains(err.Error(), "409") {
					err = nil
					continue
コード例 #2
0
				false,
				"",
				0,
				time.Date(1971, 12, 31, 0, 0, 0, 0, time.UTC),
				false,
			)
			return err
		}).Should(Succeed())

		// We have to reorder the tasks before they are present in the
		// returned response. This seems like a bug in Wunderlist API

		// Assume tasks are in first TaskPosition

		By("Reordering tasks")
		var taskPosition wl.Position

		var taskPositions []wl.Position
		Eventually(func() error {
			taskPositions, err = client.TaskPositionsForListID(newList.ID)
			return err
		}).Should(Succeed())
		taskPosition = taskPositions[0]

		taskPosition.Values = append(taskPosition.Values, newTask1.ID, newTask2.ID)

		Eventually(func() (bool, error) {
			tp, err := client.UpdateTaskPosition(taskPosition)
			if err != nil {
				return false, err
			}
コード例 #3
0
		By("Reordering subtasks")
		var firstListTasks []wl.Task
		Eventually(func() error {
			firstListTasks, err = client.TasksForListID(newList.ID)
			return err
		}).Should(Succeed())

		var index int
		for i, task := range firstListTasks {
			if task.ID == newTask.ID {
				index = i
			}
		}

		var subtaskPosition wl.Position

		Eventually(func() error {
			subtaskPositions, err := client.SubtaskPositionsForListID(newList.ID)
			if err != nil {
				return err
			}

			tp := subtaskPositions
			if len(tp) < index {
				return errors.New("subtasks not long enough to contain expected subtask")
			}
			subtaskPosition = tp[index]
			return nil
		}).Should(Succeed())