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())
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))
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'] )
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())