예제 #1
0
 def test_parse_no_priority(self):
     task = parse_task('Really gotta call Mom (A) @phone @someday')
     self.assertIsNone(task.priority)
     task = parse_task('(b) Get back to the boss')
     self.assertIsNone(task.priority)
     task = parse_task('(B)->Submit TPS report')
     self.assertIsNone(task.priority)
예제 #2
0
    def test_parse_not_complete(self):
        task = parse_task('xylophone lesson')
        self.assertIsNone(task.completion_date)

        task = parse_task('X 2012-01-01 Make resolutions')
        self.assertIsNone(task.completion_date)

        task = parse_task('(A) x Find ticket prices')
        self.assertIsNone(task.completion_date)
예제 #3
0
def send_to_todoist(api_token, path):
    """Reads all of the tasks out of the file and pushes them to todoist."""
    apiHelper = TodoistApiHelper(api_token)
    with open(path, 'r') as f:
        for line in f:
            task = parse_task(line)
            if not task.complete():
                print "Uploading: %s" % line
                apiHelper.put_task(task)
예제 #4
0
 def test_parse_priority(self):
     task = parse_task('(A) Call Mom')
     self.assertEqual(task.priority, 'A')
     self.assertEqual(task.content, 'Call Mom')
예제 #5
0
 def test_parse_content(self):
     line = '(A) Call Mom +Family +PeaceLoveAndHappiness @iphone @phone'
     task = parse_task(line)
     self.assertEqual(task.content, 'Call Mom')
예제 #6
0
 def test_parse_complete(self):
     task = parse_task('x 2011-03-03 Call Mom')
     self.assertEqual(task.completion_date, '2011-03-03')
예제 #7
0
 def test_parse_no_context(self):
     task = parse_task('Email SoAndSo at [email protected]')
     self.assertEqual(task.contexts, [])
예제 #8
0
 def test_parse_context(self):
     line = '(A) Call Mom +Family +PeaceLoveAndHappiness @iphone @phone'
     task = parse_task(line)
     self.assertListEqual(sorted(task.contexts), sorted(['iphone',
                                                         'phone']))
예제 #9
0
 def test_parse_no_project(self):
     task = parse_task('Learn how to add 2+2')
     self.assertEqual(task.projects, [])
예제 #10
0
 def test_parse_project(self):
     line = '(A) Call Mom +Family +PeaceLoveAndHappiness @iphone @phone'
     task = parse_task(line)
     self.assertListEqual(sorted(task.projects),
                          sorted(['Family', 'PeaceLoveAndHappiness']))
예제 #11
0
 def test_parse_no_creation_date(self):
     task = parse_task('(A) Call Mom 2011-03-02')
     self.assertIsNone(task.creation_date)
예제 #12
0
 def test_parse_creation_date_with_pri(self):
     task = parse_task('(A) 2011-03-02 Call Mom')
     self.assertEqual(task.creation_date, '2011-03-02')
예제 #13
0
 def test_parse_creation_date(self):
     task = parse_task('2011-03-02 Document +TodoTxt task format')
     self.assertEqual(task.creation_date, '2011-03-02')