Exemplo n.º 1
0
		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())

		subtaskPosition.Values = append(subtaskPosition.Values, newSubtask1.ID, newSubtask2.ID)

		Eventually(func() (bool, error) {
			sp, err := client.UpdateSubtaskPosition(subtaskPosition)
			if err != nil {
				return false, err
			}
			task1Contained := positionContainsValue(sp, newSubtask1.ID)
			task2Contained := positionContainsValue(sp, newSubtask2.ID)
			return task1Contained && task2Contained, err
		}).Should(BeTrue())

		Eventually(func() (bool, error) {
			firstListSubtaskPositions, err := client.SubtaskPositionsForListID(newList.ID)
			task1Contained := positionsContainValue(firstListSubtaskPositions, newSubtask1.ID)
			task2Contained := positionsContainValue(firstListSubtaskPositions, newSubtask2.ID)
Exemplo n.º 2
0
		// 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
			}
			task1Contained := positionContainsValue(tp, newTask1.ID)
			task2Contained := positionContainsValue(tp, newTask2.ID)
			return task1Contained && task2Contained, nil
		}).Should(BeTrue())

		By("Deleting tasks")
		Eventually(func() error {
			t, err := client.Task(newTask1.ID)
			if err != nil {
Exemplo n.º 3
0
		}).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
				}
				break // Unexpected error
			}
			break // No error
		}
		Expect(err).NotTo(HaveOccurred())

		list1Contained := positionContainsValue(listPosition, newList1.ID)
		list2Contained := positionContainsValue(listPosition, newList2.ID)