示例#1
0
 def test_completing_an_item_today(self):
     tl = TrickleList(name='Test List')
     tl.save()
     li = tl.listitem_set.create(name='Test item')
     li.complete()
     li.save()
     self.assertTrue(li.is_done())
示例#2
0
    def test_completing_an_item_and_checking_it_tomorrow(self):
        tl = TrickleList(name='Test List')
        tl.save()
        li = tl.listitem_set.create(name='Test item')
        yesterday = datetime.datetime.utcnow() - datetime.timedelta(days=1)
        li.complete(date=yesterday)
        li.save()

        self.assertFalse(li.is_done())
        self.assertTrue(li.is_done(date=yesterday))
示例#3
0
    def test_adding_list_items(self):
        tl = TrickleList(name='Test List')
        tl.save()
        li = ListItem(name='Test Item', trickle_list=tl)
        li.save()
        self.assertEqual(li.trickle_list.id, tl.id)

        li = tl.listitem_set.create(name='Another test item')
        li.save()
        self.assertEqual(li.trickle_list.id, tl.id)

        self.assertEqual(
            map(lambda i: i.name, tl.listitem_set.all()),
            [u'Test Item', u'Another test item']
        )
示例#4
0
 def test_that_new_items_are_not_done_today(self):
     tl = TrickleList(name='Test List')
     tl.save()
     li = tl.listitem_set.create(name='Test item')
     li.save()
     self.assertFalse(li.is_done())