示例#1
0
    def test_retweets(self):
        """No retweets or 'via'"""
        self.tweet['text'] = 'RT @someone: Firefox is awesome'
        assert _filter_tweet(self.tweet) is None

        self.tweet['text'] = 'Firefox is awesome (via @someone)'
        assert _filter_tweet(self.tweet) is None
示例#2
0
 def test_word_blacklist(self):
     # Full words are blocked.
     self.tweet['text'] = 'the word "foo" should be blocked.'
     assert _filter_tweet(self.tweet) is None
     # Substrings aren't blocked.
     self.tweet['text'] = 'but "food" should not be blocked.'
     assert _filter_tweet(self.tweet) is not None
示例#3
0
    def test_retweets(self):
        """No retweets or 'via'"""
        self.tweet['text'] = 'RT @someone: Firefox is awesome'
        assert _filter_tweet(self.tweet) is None

        self.tweet['text'] = 'Firefox is awesome (via @someone)'
        assert _filter_tweet(self.tweet) is None
示例#4
0
 def test_word_blacklist(self):
     # Full words are blocked.
     self.tweet['text'] = 'the word "foo" should be blocked.'
     assert _filter_tweet(self.tweet) is None
     # Substrings aren't blocked.
     self.tweet['text'] = 'but "food" should not be blocked.'
     assert _filter_tweet(self.tweet) is not None
示例#5
0
 def test_ignore_user(self):
     # Ignore user
     ta = TwitterAccountFactory(username='******', ignored=True)
     self.tweet['user']['screen_name'] = ta.username
     assert _filter_tweet(self.tweet) is None
     # This user is fine though
     ta = TwitterAccountFactory(username='******', ignored=False)
     self.tweet['user']['screen_name'] = ta.username
     assert _filter_tweet(self.tweet) is not None
示例#6
0
 def test_ignore_user(self):
     # Ignore user
     ta = twitter_account(username='******', ignored=True, save=True)
     self.tweet['user']['screen_name'] = ta.username
     assert _filter_tweet(self.tweet) is None
     # This user is fine though
     ta = twitter_account(username='******', ignored=False, save=True)
     self.tweet['user']['screen_name'] = ta.username
     assert _filter_tweet(self.tweet) is not None
示例#7
0
 def test_firefox_mention(self):
     """Don't filter out @firefox mentions."""
     self.tweet['text'] = 'Hey @firefox!'
     eq_(self.tweet, _filter_tweet(self.tweet))
示例#8
0
 def test_username_does_not_contain_firefox(self):
     self.tweet['user']['screen_name'] = 'ilovefirefox4ever'
     assert _filter_tweet(self.tweet) is None
示例#9
0
 def test_firefoxbrasil_mention(self):
     """Don't filter out @FirefoxBrasil mentions."""
     self.tweet['text'] = 'Olá @FirefoxBrasil!'
     eq_(self.tweet, _filter_tweet(self.tweet))
示例#10
0
 def test_mentions(self):
     """Filter out mentions."""
     self.tweet['text'] = 'Hey @someone!'
     assert _filter_tweet(self.tweet) is None
示例#11
0
 def test_links(self):
     """Filter out tweets with links."""
     self.tweet['text'] = 'Just watching: http://youtube.com/12345 Fun!'
     assert _filter_tweet(self.tweet) is None
示例#12
0
 def test_firefoxbrasil_replies(self):
     """Don't filter out @FirefoxBrasil replies."""
     self.tweet['to_user_id'] = 150793437
     self.tweet['text'] = '@FirefoxBrasil Olá!'
     eq_(self.tweet, _filter_tweet(self.tweet))
示例#13
0
 def test_replies(self):
     """Filter out replies."""
     self.tweet['to_user_id'] = 12345
     self.tweet['text'] = '@someone Hello!'
     assert _filter_tweet(self.tweet) is None
示例#14
0
 def test_fx4status(self):
     """Ensure fx4status tweets are filtered out."""
     ta = twitter_account(username='******', ignored=True, save=True)
     self.tweet['user']['screen_name'] = ta.username
     assert _filter_tweet(self.tweet) is None
示例#15
0
 def test_firefoxbrasil_mention(self):
     """Don't filter out @FirefoxBrasil mentions."""
     self.tweet['entities']['user_mentions'].append({'id': 150793437})
     eq_(self.tweet, _filter_tweet(self.tweet))
示例#16
0
 def test_firefox_mention(self):
     """Don't filter out @firefox mentions."""
     self.tweet['entities']['user_mentions'].append({'id': 2142731})
     eq_(self.tweet, _filter_tweet(self.tweet))
示例#17
0
 def test_mentions(self):
     """Filter out mentions."""
     self.tweet['entities']['user_mentions'].append({'id': 123456})
     assert _filter_tweet(self.tweet) is None
示例#18
0
 def test_username_and_tweet_contain_firefox(self):
     self.tweet['user']['screen_name'] = 'ilovefirefox4ever'
     self.tweet['text'] = 'My Firefox crashes :-( Any advice?'
     assert _filter_tweet(self.tweet) is not None
示例#19
0
 def test_firefox_mention(self):
     """Don't filter out @firefox mentions."""
     self.tweet['entities']['user_mentions'].append({'id': 2142731})
     eq_(self.tweet, _filter_tweet(self.tweet))
示例#20
0
 def test_fx4status(self):
     """Ensure fx4status tweets are filtered out."""
     ta = TwitterAccountFactory(username='******', ignored=True)
     self.tweet['user']['screen_name'] = ta.username
     assert _filter_tweet(self.tweet) is None
示例#21
0
 def test_firefoxbrasil_mention(self):
     """Don't filter out @FirefoxBrasil mentions."""
     self.tweet['entities']['user_mentions'].append({'id': 150793437})
     eq_(self.tweet, _filter_tweet(self.tweet))
示例#22
0
 def test_tweet_contains_firefox(self):
     self.tweet['text'] = 'My Firefox crashes :-( Any advice?'
     assert _filter_tweet(self.tweet) is not None
示例#23
0
 def test_firefox_replies(self):
     """Don't filter out @firefox replies."""
     self.tweet['to_user_id'] = 2142731
     self.tweet['text'] = '@firefox Hello!'
     eq_(self.tweet, _filter_tweet(self.tweet))
示例#24
0
 def test_username_does_not_contain_firefox(self):
     self.tweet['user']['screen_name'] = 'ilovefirefox4ever'
     assert _filter_tweet(self.tweet) is None
示例#25
0
 def test_firefoxbrasil_mention(self):
     """Don't filter out @FirefoxBrasil mentions."""
     self.tweet['text'] = 'Olá @FirefoxBrasil!'
     eq_(self.tweet, _filter_tweet(self.tweet))
示例#26
0
 def test_firefox_replies(self):
     """Don't filter out @firefox replies."""
     self.tweet['to_user_id'] = 2142731
     self.tweet['text'] = '@firefox Hello!'
     eq_(self.tweet, _filter_tweet(self.tweet))
示例#27
0
 def test_unfiltered(self):
     """Do not filter tweets without a reason."""
     eq_(self.tweet, _filter_tweet(self.tweet))
示例#28
0
 def test_fx4status(self):
     """Ensure fx4status tweets are filtered out."""
     self.tweet['user']['screen_name'] = 'fx4status'
     assert _filter_tweet(self.tweet) is None
示例#29
0
 def test_firefox_mention(self):
     """Don't filter out @firefox mentions."""
     self.tweet['text'] = 'Hey @firefox!'
     eq_(self.tweet, _filter_tweet(self.tweet))
示例#30
0
 def test_fx4status(self):
     """Ensure fx4status tweets are filtered out."""
     self.tweet['user']['screen_name'] = 'fx4status'
     assert _filter_tweet(self.tweet) is None
示例#31
0
 def test_replies(self):
     """Filter out replies."""
     self.tweet['to_user_id'] = 12345
     self.tweet['text'] = '@someone Hello!'
     assert _filter_tweet(self.tweet) is None
示例#32
0
 def test_tweet_contains_firefox(self):
     self.tweet['text'] = 'My Firefox crashes :-( Any advice?'
     assert _filter_tweet(self.tweet) is not None
示例#33
0
 def test_firefoxbrasil_replies(self):
     """Don't filter out @FirefoxBrasil replies."""
     self.tweet['to_user_id'] = 150793437
     self.tweet['text'] = '@FirefoxBrasil Olá!'
     eq_(self.tweet, _filter_tweet(self.tweet))
示例#34
0
 def test_unfiltered(self):
     """Do not filter tweets without a reason."""
     eq_(self.tweet, _filter_tweet(self.tweet))
示例#35
0
 def test_links(self):
     """Filter out tweets with links."""
     self.tweet['text'] = 'Just watching: http://youtube.com/12345 Fun!'
     assert _filter_tweet(self.tweet) is None
示例#36
0
 def test_mentions(self):
     """Filter out mentions."""
     self.tweet['entities']['user_mentions'].append({'id': 123456})
     assert _filter_tweet(self.tweet) is None
示例#37
0
 def test_username_and_tweet_contain_firefox(self):
     self.tweet['user']['screen_name'] = 'ilovefirefox4ever'
     self.tweet['text'] = 'My Firefox crashes :-( Any advice?'
     assert _filter_tweet(self.tweet) is not None
示例#38
0
 def test_mentions(self):
     """Filter out mentions."""
     self.tweet['text'] = 'Hey @someone!'
     assert _filter_tweet(self.tweet) is None