Exemplo n.º 1
0
 def test_list_tweet_by_hashtag(self):
     tweet = 'Tweet #test'
     tweet2 = 'another #tweet'
     Tweet.objects.create(message=tweet, user=mommy.make(User))
     Tweet.objects.create(message=tweet2, user=mommy.make(User))
     client = Client()
     response = client.get(reverse('blog:hashtag-tweet-list', args=['test']))
     self.assertIn(hashtagify(tweet), response.content)
     self.assertNotIn(hashtagify(tweet2), response.content)        
Exemplo n.º 2
0
 def test_hashtagify(self):
     tweet = 'Simple #tweet for #django'
     url_django = reverse('blog:hashtag-tweet-list', args=['django'])
     url_tweet= reverse('blog:hashtag-tweet-list', args=['tweet'])
     expected ='Simple <a href="%s">#tweet</a> for <a href="%s">#django</a>' % (url_tweet, url_django)
     self.assertEqual(hashtagify(tweet), expected)