Example #1
0
 def test_simple_task_url_is_correct(self):
     """The URL for a simple task is correct."""
     task_title = 'Test title of the task.'
     quoted_title = quote(task_title)
     expected_url = 'twodo://x-callback-url/add?task=' + quoted_title
     task = TwoDoTask(task_title)
     self.assertEqual(task.url(), expected_url)
Example #2
0
 def test_task_with_daily_repeat_url_is_correct(self):
     """The URL for a task with daily repetition is correct."""
     task_title = 'Test title of the task.'
     quoted_title = quote(task_title)
     expected_url = 'twodo://x-callback-url/add?task=' + quoted_title
     expected_url += '&repeat={}'.format(TwoDoTask.DAILY)
     task = TwoDoTask(task_title, repeat='1')
     self.assertEqual(task.url(), expected_url)
Example #3
0
 def test_task_with_rel_duedate_url_is_correct(self):
     """The URL for a task with a relative due date is correct."""
     task_title = 'Test title of the task.'
     quoted_title = quote(task_title)
     expected_url = 'twodo://x-callback-url/add?task=' + quoted_title
     expected_url += '&due=7'
     task = TwoDoTask(task_title, due='7')
     self.assertEqual(task.url(), expected_url)
Example #4
0
 def test_starred_task_url_is_correct_one(self):
     """The URL for a starred task is correct."""
     task_title = 'Test title of the task.'
     quoted_title = quote(task_title)
     expected_url = 'twodo://x-callback-url/add?task=' + quoted_title
     expected_url += '&starred=1'
     task = TwoDoTask(task_title, starred=True)
     self.assertEqual(task.url(), expected_url)
Example #5
0
 def test_task_with_prio_url_is_correct(self):
     """The URL for a task with a priority is correct."""
     task_title = 'Test title of the task.'
     quoted_title = quote(task_title)
     expected_url = 'twodo://x-callback-url/add?task=' + quoted_title
     expected_url += '&priority=3'
     task = TwoDoTask(task_title, priority=3)
     self.assertEqual(task.url(), expected_url)
Example #6
0
 def test_project_task_url_is_correct(self):
     """The URL for a project task is correct."""
     task_title = 'Test title of the task.'
     quoted_title = quote(task_title)
     expected_url = 'twodo://x-callback-url/add?task=' + quoted_title
     expected_url += '&type=1'
     task = TwoDoTask(task_title, task_type='1')
     self.assertEqual(task.url(), expected_url)
Example #7
0
 def test_task_with_rel_start_time_url_is_correct(self):
     """The URL for a task with a relative start date ist correct."""
     task_title = 'Test title of the task.'
     quoted_title = quote(task_title)
     task_start = "14"
     quoted_start = quote(task_start)
     expected_url = 'twodo://x-callback-url/add?task=' + quoted_title
     expected_url += '&start={}'.format(quoted_start)
     task = TwoDoTask(task_title, start=task_start)
     self.assertEqual(task.url(), expected_url)
Example #8
0
 def test_task_with_duetime_url_is_correct(self):
     """The URL for a task with a due time is correct."""
     task_title = 'Test title of the task.'
     quoted_title = quote(task_title)
     task_duetime = "12:00"
     quoted_duetime = quote(task_duetime)
     expected_url = 'twodo://x-callback-url/add?task=' + quoted_title
     expected_url += '&dueTime={}'.format(quoted_duetime)
     task = TwoDoTask(task_title, dueTime=task_duetime)
     self.assertEqual(task.url(), expected_url)
Example #9
0
 def test_task_with_iso_duedate_url_is_correct(self):
     """The URL for a task with a iso formatted due date is correct."""
     task_title = 'Test title of the task.'
     quoted_title = quote(task_title)
     task_due = "2015-10-02"
     quoted_due = quote(task_due)
     expected_url = 'twodo://x-callback-url/add?task=' + quoted_title
     expected_url += '&due={}'.format(quoted_due)
     task = TwoDoTask(task_title, due=task_due)
     self.assertEqual(task.url(), expected_url)
Example #10
0
 def test_task_with_tags_url_is_correct(self):
     """The URL for a task with some tags is correct."""
     task_title = 'Test title of the task.'
     quoted_title = quote(task_title)
     task_tags = "business,important,customer"
     quoted_tags = quote(task_tags)
     expected_url = 'twodo://x-callback-url/add?task=' + quoted_title
     expected_url += '&tags={}'.format(quoted_tags)
     task = TwoDoTask(task_title, tags=task_tags)
     self.assertEqual(task.url(), expected_url)
Example #11
0
 def test_task_with_a_note_url_is_correct(self):
     """The URL for a task with a note is correct."""
     task_title = 'Test title of the task.'
     quoted_title = quote(task_title)
     task_note = "A little note to this important task."
     quoted_note = quote(task_note)
     expected_url = 'twodo://x-callback-url/add?task=' + quoted_title
     expected_url += '&note={}'.format(quoted_note)
     task = TwoDoTask(task_title, note=task_note)
     self.assertEqual(task.url(), expected_url)
Example #12
0
 def test_task_for_a_list_url_is_correct(self):
     """The URL for a task for a list is correct."""
     task_title = 'Test title of the task.'
     quoted_title = quote(task_title)
     task_list = 'urgent errands'
     quoted_list = quote(task_list)
     expected_url = 'twodo://x-callback-url/add?task=' + quoted_title
     expected_url += '&forlist={}'.format(quoted_list)
     task = TwoDoTask(task_title, for_list=task_list)
     self.assertEqual(task.url(), expected_url)
Example #13
0
 def test_task_add_to_project_is_correct(self):
     """The URL for pasting a task to a project is correct."""
     task_title = 'Buy milk.'
     in_list = "personal"
     quoted_in_list = quote(in_list)
     in_project = "errands"
     quoted_in_project = quote(in_project)
     quoted_title = quote(task_title)
     expected_url = 'twodo://x-callback-url/paste?text=' + quoted_title
     expected_url += '&inProject=' + quoted_in_project
     expected_url += '&forList=' + quoted_in_list
     task = TwoDoTask(task_title, for_list=in_list, in_project=in_project)
     self.assertEqual(task.url(), expected_url)