def test_clear_tasks(self):
     e.new_list(*build_context("foo\nbar\nbaz"))
     e.start_task(*build_context("foo"))
     e.check_task(*build_context("foo"))
     e.start_task(*build_context("bar"))
     actual, _, _ = e.clear_checked_tasks(*build_context())
     expected = f"FunctionalTestUser's list\n" \
                f":arrow_forward: bar    (1)\n" \
                f":white_large_square: baz    (2)"
     self.assertEqual(expected, actual)
 def test_check_list(self):
     e.new_list(*build_context("foo\nbar\nbaz\nfweep\nslurp"))
     e.start_task(*build_context("foo"))
     actual, _, _ = e.check_list(*build_context("1 2 4"))
     expected = f"{OWNER.name}'s list\n" \
                ":white_check_mark: foo    (1)\n" \
                ":white_check_mark: bar    (2)\n" \
                ":white_large_square: baz    (3)\n" \
                ":white_check_mark: fweep    (4)\n" \
                ":white_large_square: slurp    (5)"
     self.assertEqual(expected, actual)
 def test_check_and_uncheck_task(self):
     e.new_list(*build_context("foo\nbar\nbaz"))
     e.start_task(*build_context("bar"))
     actual, _, _ = e.check_task(*build_context("bar"))
     expected = f"{OWNER.name}'s list\n" \
                ":white_large_square: foo    (1)\n" \
                ":white_check_mark: bar    (2)\n" \
                ":white_large_square: baz    (3)"
     self.assertEqual(expected, actual)
     actual, _, _ = e.uncheck_task(*build_context("bar"))
     expected = f"{OWNER.name}'s list\n" \
                ":white_large_square: foo    (1)\n" \
                ":white_large_square: bar    (2)\n" \
                ":white_large_square: baz    (3)"
     self.assertEqual(expected, actual)
 def test_start_and_stop_task(self):
     e.new_list(*build_context("foo\nbar\nbaz"))
     actual, _, _ = e.start_task(*build_context("bar"))
     expected = f"{OWNER.name}'s list\n" \
                ":white_large_square: foo    (1)\n" \
                ":arrow_forward: bar    (2)\n" \
                ":white_large_square: baz    (3)"
     self.assertEqual(expected, actual)
     actual, _, _ = e.stop_task(*build_context("bar"))
     expected = f"{OWNER.name}'s list\n" \
                ":white_large_square: foo    (1)\n" \
                ":white_large_square: bar    (2)\n" \
                ":white_large_square: baz    (3)"
     self.assertEqual(expected, actual)
 def test_time_spent_sec(self):
     e.new_list(*build_context("foo\nbar\nbaz"))
     e.start_task(*build_context("foo"))
     sleep(2)
     e.stop_task(*build_context("foo"))
     e.start_task(*build_context("bar"))
     sleep(2)
     e.check_task(*build_context("bar"))
     e.start_task(*build_context("foo"))
     sleep(2)
     e.check_task(*build_context("foo"))
     actual, _, _ = e.task_time(*build_context())
     expected = f"{OWNER.name} times\n" \
                f"foo: 4s\n" \
                f"bar: 2s\n" \
                f"baz: 0s\n" \
                f"\n" \
                f"Total time: 6s"
     self.assertEqual(expected, actual)
 def test_check_list_item_not_in_list(self):
     e.new_list(*build_context("foo\nbar\nbaz"))
     e.start_task(*build_context("foo"))
     with self.assertRaisesRegex(ListBotError, "4 is not a valid list position."):
         e.check_list(*build_context("1 2 4"))
 def test_check_list_invalid_entry(self):
     e.new_list(*build_context("foo\nbar\nbaz"))
     e.start_task(*build_context("foo"))
     actual, _, _ = e.check_list(*build_context("1 2 fweep"))
     expected = "All arguments must be positions of tasks, not names."
     self.assertEqual(expected, actual)
 def test_already_started(self):
     e.new_list(*build_context("foo\nbar\nbaz"))
     e.start_task(*build_context("bar"))
     actual, _, _ = e.start_task(*build_context("bar"))
     expected = "That task is already started."
     self.assertEqual(expected, actual)
 def test_start_two_tasks(self):
     e.new_list(*build_context("foo\nbar\nbaz"))
     e.start_task(*build_context("foo"))
     actual, _, _ = e.start_task(*build_context("bar"))
     expected = "You can only have one started task at a time."
     self.assertEqual(expected, actual)