Ejemplo n.º 1
0
 def test_working(self):
     item = Item(name='w8in4')
     item.status = Item.WAITING_FOR
     item.save()
     response = Client().get(reverse('gtdmanager:waiting'))
     self.assertEqual(response.status_code, 200)
     self.assertItemsEqual((item, ), response.context['items'])
Ejemplo n.º 2
0
 def test_someday_item(self):
     item = Item(name='maybe')
     item.save()
     self.assertEqual(item.status, Item.UNRESOLVED)
     response = Client().get(reverse('gtdmanager:item_someday', args=(item.id,)))
     item = Item.objects.get(id=item.id)
     self.assertEqual(item.status, Item.SOMEDAY)
Ejemplo n.º 3
0
 def test_working(self):
     item = Item(name='ref')
     item.status = Item.REFERENCE
     item.save()
     response = Client().get(reverse('gtdmanager:references'))
     self.assertEqual(response.status_code, 200)
     self.assertItemsEqual((item, ), response.context['items'])
Ejemplo n.º 4
0
 def test_wait_item(self):
     item = Item(name='waiting for Xmas')
     item.save()
     self.assertEqual(item.status, Item.UNRESOLVED)
     response = Client().get(reverse('gtdmanager:item_wait', args=(item.id,)))
     item = Item.objects.get(id=item.id)
     self.assertEqual(item.status, Item.WAITING_FOR)
Ejemplo n.º 5
0
 def test_complete_item(self):
     item = Item(name='completed item')
     item.save()
     self.assertEqual(item.status, Item.UNRESOLVED)
     response = Client().get(reverse('gtdmanager:item_complete', args=(item.id, 'inbox')))
     item = Item.objects.get(id=item.id)
     self.assertEqual(item.status, Item.COMPLETED)
Ejemplo n.º 6
0
 def test_reference_item(self):
     item = Item(name='reference')
     item.save()
     self.assertEqual(item.status, Item.UNRESOLVED)
     response = Client().get(reverse('gtdmanager:item_reference', args=(item.id,)))
     item = Item.objects.get(id=item.id)
     self.assertEqual(item.status, Item.REFERENCE)
Ejemplo n.º 7
0
 def test_working(self):
     item = Item(name='ref')
     item.status = Item.SOMEDAY
     item.save()
     response = Client().get(reverse('gtdmanager:someday'))
     self.assertEqual(response.status_code, 200)
     self.assertItemsEqual((item,), response.context['items'])
Ejemplo n.º 8
0
 def test_working(self):
     item = Item(name='ref')
     item.status = Item.REFERENCE
     item.save()
     response = Client().get(reverse('gtdmanager:references'))
     self.assertEqual(response.status_code, 200)
     self.assertItemsEqual((item,), response.context['items'])
Ejemplo n.º 9
0
 def test_working(self):
     item = Item(name='w8in4')
     item.status = Item.WAITING_FOR
     item.save()
     response = Client().get(reverse('gtdmanager:waiting'))
     self.assertEqual(response.status_code, 200)
     self.assertItemsEqual((item,), response.context['items'])
Ejemplo n.º 10
0
 def test_working(self):
     item = Item(name='ref')
     item.status = Item.SOMEDAY
     item.save()
     response = Client().get(reverse('gtdmanager:someday'))
     self.assertEqual(response.status_code, 200)
     self.assertItemsEqual((item, ), response.context['items'])
Ejemplo n.º 11
0
 def convert(self, with_save):
     item = Item(name='task')
     if (with_save):
         item.save()
     converted = Item.objects.convertTo(Next, item)
     self.assertIsInstance(converted, Next)
     self.assertEqual(Item.objects.count(), 1)
     self.assertEqual(Next.objects.count(), 1)
Ejemplo n.º 12
0
 def convert(self, with_save):
     item = Item(name='task')
     if (with_save):
         item.save()
     converted = Item.objects.convertTo(Next, item)
     self.assertIsInstance(converted, Next)
     self.assertEqual(Item.objects.count(), 1)
     self.assertEqual(Next.objects.count(), 1)
Ejemplo n.º 13
0
 def test_complete_item(self):
     item = Item(name='completed item')
     item.save()
     self.assertEqual(item.status, Item.UNRESOLVED)
     response = Client().get(
         reverse('gtdmanager:item_complete', args=(item.id, 'inbox')))
     item = Item.objects.get(id=item.id)
     self.assertEqual(item.status, Item.COMPLETED)
Ejemplo n.º 14
0
 def test_item_to_project(self):
     item = Item(name='perfect project')
     item.save()
     self.assertEqual(item.status, Item.UNRESOLVED)
     Client().get(reverse('gtdmanager:item_to_project', args=(item.id,)))
     item = Item.objects.get(id=item.id)
     self.assertEqual(item.status, Item.PROJECT)
     self.assertEqual(len(Item.objects.all()), 1)  # no new item not created
Ejemplo n.º 15
0
 def test_has_short_id(self):
     """
     Tests whether Item class has some sort of short id (e.g. id field)
     that can be used for identifying in URLs
     """
     item = Item(name="item")
     item.save()
     self.assertTrue(item.id in (0,1))
Ejemplo n.º 16
0
 def test_has_short_id(self):
     """
     Tests whether Item class has some sort of short id (e.g. id field)
     that can be used for identifying in URLs
     """
     item = Item(name="item")
     item.save()
     self.assertTrue(item.id in (0, 1))
Ejemplo n.º 17
0
 def test_reference_item(self):
     item = Item(name='reference')
     item.save()
     self.assertEqual(item.status, Item.UNRESOLVED)
     response = Client().get(
         reverse('gtdmanager:item_reference', args=(item.id, )))
     item = Item.objects.get(id=item.id)
     self.assertEqual(item.status, Item.REFERENCE)
Ejemplo n.º 18
0
 def test_someday_item(self):
     item = Item(name='maybe')
     item.save()
     self.assertEqual(item.status, Item.UNRESOLVED)
     response = Client().get(
         reverse('gtdmanager:item_someday', args=(item.id, )))
     item = Item.objects.get(id=item.id)
     self.assertEqual(item.status, Item.SOMEDAY)
Ejemplo n.º 19
0
 def test_wait_item(self):
     item = Item(name='waiting for Xmas')
     item.save()
     self.assertEqual(item.status, Item.UNRESOLVED)
     response = Client().get(
         reverse('gtdmanager:item_wait', args=(item.id, )))
     item = Item.objects.get(id=item.id)
     self.assertEqual(item.status, Item.WAITING_FOR)
Ejemplo n.º 20
0
 def test_item_to_project(self):
     item = Item(name='perfect project')
     item.save()
     self.assertEqual(item.status, Item.UNRESOLVED)
     Client().get(reverse('gtdmanager:item_to_project', args=(item.id, )))
     item = Item.objects.get(id=item.id)
     self.assertEqual(item.status, Item.PROJECT)
     self.assertEqual(len(Item.objects.all()), 1)  # no new item not created
Ejemplo n.º 21
0
 def test_convert(self):
     item = Item(name='Tst')
     item.save()
     self.assertEqual(item.status, Item.UNRESOLVED)
     self.assertEqual(len(Item.objects.all()), 1)
     self.assertEqual(len(Project.objects.all()), 0)
     p = Item.objects.convertTo(Project, item)
     p.save()
     self.assertEqual(p.status, Item.PROJECT)
     self.assertEqual(len(Item.objects.all()), 1)
     self.assertEqual(len(Project.objects.all()), 1)
Ejemplo n.º 22
0
 def test_convert(self):
     item = Item(name='Tst')
     item.save()
     self.assertEqual(item.status, Item.UNRESOLVED)
     self.assertEqual(len(Item.objects.all()), 1)
     self.assertEqual(len(Project.objects.all()), 0)
     p = Item.objects.convertTo(Project, item)
     p.save()
     self.assertEqual(p.status, Item.PROJECT)
     self.assertEqual(len(Item.objects.all()), 1)
     self.assertEqual(len(Project.objects.all()), 1)
Ejemplo n.º 23
0
 def test_active_childs_item(self):
     p = Project(name='p')
     p.save()
     Item(name='compl', status=Item.COMPLETED, parent=p).save()
     Item(name='del', status=Item.DELETED, parent=p).save()
     Item(name='sm', status=Item.SOMEDAY, parent=p).save()
     Item(name='ref', status=Item.REFERENCE, parent=p).save()
     waiting = Item(name='wait', status=Item.WAITING_FOR, parent=p)
     waiting.save()
     reminder = Reminder(name='arem', parent=p)
     reminder.save()
     anext = Next(name='next', parent=p)
     anext.save()
     self.assertEqual(p.item_set.count(), 7)
     self.assertItemsEqual((waiting, anext, reminder), p.active_childs())
Ejemplo n.º 24
0
 def template_cancel(self, cls, class_url):
     item = Item(name='item')
     item.save()
     client = Client()
     # convert to next
     response = client.get(reverse('gtdmanager:' + class_url + '_edit', args=(item.id, 'inbox')))
     self.assertEqual(response.status_code, 200)
     converted = cls.objects.get(pk=item.id)
     self.assertEqual(converted.name, item.name)
     # cancel
     response = client.get(reverse('gtdmanager:' + class_url + '_to_item', args=(converted.id, 'inbox')))
     self.assertRedirects(response, reverse('gtdmanager:inbox'))
     self.assertEqual(cls.objects.count(), 0)
     item = Item.objects.get(pk=item.id)
     self.assertEqual(converted.name, item.name)
Ejemplo n.º 25
0
 def template_cancel(self, cls, class_url):
     item = Item(name='item')
     item.save()
     client = Client()
     # convert to next
     response = client.get(
         reverse('gtdmanager:' + class_url + '_edit',
                 args=(item.id, 'inbox')))
     self.assertEqual(response.status_code, 200)
     converted = cls.objects.get(pk=item.id)
     self.assertEqual(converted.name, item.name)
     # cancel
     response = client.get(
         reverse('gtdmanager:' + class_url + '_to_item',
                 args=(converted.id, 'inbox')))
     self.assertRedirects(response, reverse('gtdmanager:inbox'))
     self.assertEqual(cls.objects.count(), 0)
     item = Item.objects.get(pk=item.id)
     self.assertEqual(converted.name, item.name)
Ejemplo n.º 26
0
 def test_active_childs_item(self):
     p = Project(name='p')
     p.save()
     Item(name='compl', status=Item.COMPLETED, parent=p).save()
     Item(name='del', status=Item.DELETED, parent=p).save()
     Item(name='sm', status=Item.SOMEDAY, parent=p).save()
     Item(name='ref', status=Item.REFERENCE, parent=p).save()
     waiting = Item(name='wait', status=Item.WAITING_FOR, parent=p)
     waiting.save()
     reminder = Reminder(name='arem', parent=p)
     reminder.save()
     anext = Next(name='next', parent=p)
     anext.save()
     self.assertEqual(p.item_set.count(), 7)
     self.assertItemsEqual((waiting, anext, reminder), p.active_childs())
Ejemplo n.º 27
0
 def test_gtddelete(self):
     item = Item(name='del')
     item.gtddelete()
     self.assertEqual(Item.DELETED, item.status)
Ejemplo n.º 28
0
 def _prepare_with_active_subproject(self):
     p, sub = self._prepare_with_child(Project)
     i = Item(name='item', parent = sub)
     i.save()
     return (p, sub, i)
Ejemplo n.º 29
0
 def _prepare_with_active_subproject(self):
     p, sub = self._prepare_with_child(Project)
     i = Item(name='item', parent=sub)
     i.save()
     return (p, sub, i)
Ejemplo n.º 30
0
 def test_complete(self):
     item = Item(name='compl')
     item.complete()
     self.assertEqual(Item.COMPLETED, item.status)
Ejemplo n.º 31
0
 def __init__(self, *args, **kwargs):
     if 'instance' not in kwargs:
         kwargs['instance'] = Item()
     super(ItemForm, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.helper.add_input(Submit('submit', 'Submit'))
Ejemplo n.º 32
0
 def test_complete(self):
     item = Item(name='compl')
     item.complete()
     self.assertEqual(Item.COMPLETED, item.status)
Ejemplo n.º 33
0
 def test_working(self):
     p = Project(name='p')
     p.save()
     sub = Project(name='subproject', parent=p)
     sub.save()
     completed = Item(name='compl', status=Item.COMPLETED, parent=p)
     completed.save()
     deleted = Item(name='del', status=Item.DELETED, parent=p)
     deleted.save()
     someday = Item(name='sm', status=Item.SOMEDAY, parent=p)
     someday.save()
     reference = Item(name='ref', status=Item.REFERENCE, parent=p)
     reference.save()
     waiting = Item(name='wait', status=Item.WAITING_FOR, parent=p)
     waiting.save()
     reminder = Reminder(name='arem', parent=p)
     reminder.save()
     anext = Next(name='next', parent=p)
     anext.save()
     self.assertEqual(p.item_set.count(), 8)
     
     response = Client().get(reverse('gtdmanager:project_detail', args=(p.id,)))
     self.assertEqual(response.status_code, 200)
     self.assertItemsEqual(response.context['subprojects'], (sub,))
     self.assertItemsEqual(response.context['nexts'], (anext,))
     self.assertItemsEqual(response.context['reminders'], (reminder,))
     self.assertItemsEqual(response.context['waiting'], (waiting,))
     self.assertItemsEqual(response.context['somedays'], (someday,))
     self.assertItemsEqual(response.context['references'], (reference,))
     self.assertItemsEqual(response.context['completed'], (completed,))
     self.assertItemsEqual(response.context['deleted'], (deleted,))
Ejemplo n.º 34
0
def prepare_completed_deleted():
    item = Item(name='completed', status=Item.COMPLETED)
    item.save()
    item2 = Item(name='deleted', status=Item.DELETED)
    item2.save()
    return (item, item2)
Ejemplo n.º 35
0
    def test_working(self):
        p = Project(name='p')
        p.save()
        sub = Project(name='subproject', parent=p)
        sub.save()
        completed = Item(name='compl', status=Item.COMPLETED, parent=p)
        completed.save()
        deleted = Item(name='del', status=Item.DELETED, parent=p)
        deleted.save()
        someday = Item(name='sm', status=Item.SOMEDAY, parent=p)
        someday.save()
        reference = Item(name='ref', status=Item.REFERENCE, parent=p)
        reference.save()
        waiting = Item(name='wait', status=Item.WAITING_FOR, parent=p)
        waiting.save()
        reminder = Reminder(name='arem', parent=p)
        reminder.save()
        anext = Next(name='next', parent=p)
        anext.save()
        self.assertEqual(p.item_set.count(), 8)

        response = Client().get(
            reverse('gtdmanager:project_detail', args=(p.id, )))
        self.assertEqual(response.status_code, 200)
        self.assertItemsEqual(response.context['subprojects'], (sub, ))
        self.assertItemsEqual(response.context['nexts'], (anext, ))
        self.assertItemsEqual(response.context['reminders'], (reminder, ))
        self.assertItemsEqual(response.context['waiting'], (waiting, ))
        self.assertItemsEqual(response.context['somedays'], (someday, ))
        self.assertItemsEqual(response.context['references'], (reference, ))
        self.assertItemsEqual(response.context['completed'], (completed, ))
        self.assertItemsEqual(response.context['deleted'], (deleted, ))
Ejemplo n.º 36
0
 def test_gtddelete(self):
     item = Item(name='del')
     item.gtddelete()
     self.assertEqual(Item.DELETED, item.status)
Ejemplo n.º 37
0
def prepare_completed_deleted():
    item = Item(name='completed', status = Item.COMPLETED)
    item.save()
    item2 = Item(name='deleted', status = Item.DELETED)
    item2.save()
    return (item, item2)