예제 #1
0
 def test_block(self):
     task1 = Task.create()
     task2 = Task.create()
     self.assertTrue(not task1.is_blocked())
     self.assertTrue(not task2.is_blocked())
     task1.block_on(task2)
     self.assertTrue(task1.is_blocked())
     self.assertTrue(not task2.is_blocked())
     task1.unblock()
     self.assertTrue(not task1.is_blocked())
     self.assertTrue(not task2.is_blocked())
     task1.block_on(task2)
     task1.unblock(task2)
     self.assertTrue(not task1.is_blocked())
     self.assertTrue(not task2.is_blocked())
예제 #2
0
 def test_block(self):
     task1 = Task.create()
     task2 = Task.create()
     self.assertTrue(not task1.is_blocked())
     self.assertTrue(not task2.is_blocked())
     task1.block_on(task2)
     self.assertTrue(task1.is_blocked())
     self.assertTrue(not task2.is_blocked())
     task1.unblock()
     self.assertTrue(not task1.is_blocked())
     self.assertTrue(not task2.is_blocked())
     task1.block_on(task2)
     task1.unblock(task2)
     self.assertTrue(not task1.is_blocked())
     self.assertTrue(not task2.is_blocked())
예제 #3
0
 def test_delegate(self):
     task = Task.create()
     self.assertTrue(not task.is_delegated())
     task.delegate('Bob')
     self.assertTrue(task.is_delegated())
     task.undelegate()
     self.assertTrue(not task.is_delegated())
예제 #4
0
 def test_update_task(self):
     misspelled_summary = "My frist task"
     correct_summary = "My first task"
     task = Task.create(summary=misspelled_summary)
     task.summary = correct_summary
     task.save()
     self.assertEqual(task.summary, correct_summary)
예제 #5
0
 def test_delegate(self):
     task = Task.create()
     self.assertTrue(not task.is_delegated())
     task.delegate('Bob')
     self.assertTrue(task.is_delegated())
     task.undelegate()
     self.assertTrue(not task.is_delegated())
예제 #6
0
 def test_update_task(self):
     misspelled_summary = "My frist task"
     correct_summary = "My first task"
     task = Task.create(summary=misspelled_summary)
     task.summary = correct_summary
     task.save()
     self.assertEqual(task.summary, correct_summary)
예제 #7
0
 def test_trash(self):
     task = Task.create()
     self.assertTrue(not task.trashed)
     task.trash()
     self.assertTrue(task.trashed)
     self.assertTrue(not task.is_active())
     task.sleep()
     # self.assertTrue(tid not in tasks.filter(sleeping=True))
     task.unsleep()
     task.delegate("Bob")
     # self.assertTrue(tid not in tasks.filter(delegated=True))
     task.undelegate()
     task2 = Task.create()
     task.block_on(task2)
     # self.assertTrue(tid not in tasks.filter(blocked=True))
     task.unblock()
     task.complete()
예제 #8
0
 def test_trash(self):
     task = Task.create()
     self.assertTrue(not task.trashed)
     task.trash()
     self.assertTrue(task.trashed)
     self.assertTrue(not task.is_active())
     task.sleep()
     # self.assertTrue(tid not in tasks.filter(sleeping=True))
     task.unsleep()
     task.delegate("Bob")
     # self.assertTrue(tid not in tasks.filter(delegated=True))
     task.undelegate()
     task2 = Task.create()
     task.block_on(task2)
     # self.assertTrue(tid not in tasks.filter(blocked=True))
     task.unblock()
     task.complete()
예제 #9
0
 def test_active(self):
     task = Task.create()
     self.assertTrue(task.is_active())
     task.sleep()
     self.assertTrue(not task.is_active())
     task.unsleep()
     self.assertTrue(task.is_active())
     task2 = Task.create()
     task.block_on(task2)
     self.assertTrue(not task.is_active())
     task.unblock()
     self.assertTrue(task.is_active())
     task.complete()
     self.assertTrue(not task.is_active())
     task.uncomplete()
     self.assertTrue(task.is_active())
     task.trash()
     self.assertTrue(not task.is_active())
     task.untrash()
     self.assertTrue(task.is_active())
예제 #10
0
 def test_active(self):
     task = Task.create()
     self.assertTrue(task.is_active())
     task.sleep()
     self.assertTrue(not task.is_active())
     task.unsleep()
     self.assertTrue(task.is_active())
     task2 = Task.create()
     task.block_on(task2)
     self.assertTrue(not task.is_active())
     task.unblock()
     self.assertTrue(task.is_active())
     task.complete()
     self.assertTrue(not task.is_active())
     task.uncomplete()
     self.assertTrue(task.is_active())
     task.trash()
     self.assertTrue(not task.is_active())
     task.untrash()
     self.assertTrue(task.is_active())
예제 #11
0
 def test_sleep(self):
     now = datetime.datetime.now()
     future = now + datetime.timedelta(days=1)
     past = now - datetime.timedelta(days=1)
     task = Task.create()
     self.assertTrue(not task.is_sleeping())
     task.sleep(future)
     self.assertTrue(task.is_sleeping())
     task.unsleep()
     self.assertTrue(not task.is_sleeping())
     task.sleep()
     self.assertTrue(task.is_sleeping())
     task.unsleep()
     self.assertTrue(not task.is_sleeping())
     task.sleep(past)
     self.assertTrue(not task.is_sleeping())
예제 #12
0
 def test_sleep(self):
     now = datetime.datetime.now()
     future = now + datetime.timedelta(days=1)
     past = now - datetime.timedelta(days=1)
     task = Task.create()
     self.assertTrue(not task.is_sleeping())
     task.sleep(future)
     self.assertTrue(task.is_sleeping())
     task.unsleep()
     self.assertTrue(not task.is_sleeping())
     task.sleep()
     self.assertTrue(task.is_sleeping())
     task.unsleep()
     self.assertTrue(not task.is_sleeping())
     task.sleep(past)
     self.assertTrue(not task.is_sleeping())
예제 #13
0
 def test_complete(self):
     task = Task.create()
     self.assertTrue(not task.completed)
     task.complete()
     self.assertTrue(task.completed)
예제 #14
0
 def test_create_task(self):
     summary = "My first task"
     task = Task.create(summary=summary)
     self.assertEqual(task.summary, summary)
예제 #15
0
 def test_complete(self):
     task = Task.create()
     self.assertTrue(not task.completed)
     task.complete()
     self.assertTrue(task.completed)
예제 #16
0
 def test_create_task(self):
     summary = "My first task"
     task = Task.create(summary=summary)
     self.assertEqual(task.summary, summary)