def test_get_found(self): r = TweetRepository() r.add(Tweet("Welcome")) tweet = r.get(0) #print(tweet) self.assertEqual(tweet.text, "Welcome") self.assertEqual(tweet.id, 0)
def test_auto_increment_of_ids(self): repository = TweetRepository() first_tweet = Tweet("a first tweet") repository.add(first_tweet) self.assertEqual(first_tweet.id, 1) second_tweet = Tweet("a second tweet") repository.add(second_tweet) self.assertEqual(second_tweet.id, 2)
def test_auto_increment_after_adding_a_tweet(self): tweet_repository = TweetRepository() tweet = Tweet("RAPH") tweet2 = Tweet("JOHN") tweet_repository.add(tweet) tweet_repository.add(tweet2) self.assertEqual(tweet.id, 1) self.assertEqual(tweet2.id, 2)
def test_del_tweet(self): repo = TweetRepository() tweet = Tweet("my first tweet") new_tweet = repo.add(tweet) old_size = repo.tweets_count() tweet = repo.del_tweet(1) self.assertIsNotNone(tweet.id) new_size = repo.tweets_count() self.assertEqual(old_size - 1, new_size)
def test_new_tweet(self): repo = TweetRepository() old_size = repo.tweets_count() tweet = Tweet("my first tweet") self.assertIsNotNone(tweet.created_at) new_tweet = repo.add(tweet) self.assertIsNotNone(new_tweet.id) new_size = repo.tweets_count() self.assertEqual(old_size + 1, new_size)
def test_get_tweet(self): repository = TweetRepository() tweet = Tweet("a new tweet") repository.add(tweet) self.assertEqual(tweet, repository.get(1)) self.assertIsNone(repository.get(2))
def test_add_tweet(self): repository = TweetRepository() tweet = Tweet("a new tweet") repository.add(tweet) self.assertEqual(len(repository.tweets), 1)
def test_add_tweet(self): repository = TweetRepository() tweet = Tweet("I am a new tweet !") repository.add(tweet) self.assertEqual(len(repository.tweets), 1) # check tweet has been added to tweets
def test_get_tweet(self): tweet_repository = TweetRepository() tweet = Tweet("RAPH") tweet_repository.add(tweet) self.assertEqual(tweet, tweet_repository.get(1)) self.assertIsNone(tweet_repository.get(2))
def test_add_a_tweet(self): tweet_repository = TweetRepository() tweet = Tweet("RAPH") tweet_repository.add(tweet) self.assertEqual(len(tweet_repository.tweets), 1)
def test_delet_found(self): r = TweetRepository() r.add(Tweet("Welcome")) r.delete(0) self.assertEqual(len(r.data), 0)
def test_add(self): r = TweetRepository() r.add(Tweet("Welcome")) self.assertEqual(len(r.data), 1)