def test_increment_id(self): repository = Repository() tweet1 = Tweet("Ah que coucou.") repository.add(tweet1) self.assertEqual(tweet1.id, 1) tweet2 = Tweet("Tirelipimpon sur le Chihuahua.") repository.add(tweet2) self.assertEqual(tweet2.id, 2)
def test_get(self): repository = Repository() tweet = Tweet("Le gras c'est la vie.") repository.add(tweet) self.assertEqual(tweet, repository.get(1)) self.assertIsNone(repository.get(2))
def test_add(self): repository = Repository() tweet = Tweet("Coucou petite perruche.") repository.add(tweet) self.assertEqual(len(repository.tweets), 1)