Beispiel #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
Beispiel #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
Beispiel #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
Beispiel #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
Beispiel #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
Beispiel #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
Beispiel #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))
Beispiel #8
0
 def test_username_does_not_contain_firefox(self):
     self.tweet['user']['screen_name'] = 'ilovefirefox4ever'
     assert _filter_tweet(self.tweet) is None
Beispiel #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))
Beispiel #10
0
 def test_mentions(self):
     """Filter out mentions."""
     self.tweet['text'] = 'Hey @someone!'
     assert _filter_tweet(self.tweet) is None
Beispiel #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
Beispiel #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))
Beispiel #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
Beispiel #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
Beispiel #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))
Beispiel #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))
Beispiel #17
0
 def test_mentions(self):
     """Filter out mentions."""
     self.tweet['entities']['user_mentions'].append({'id': 123456})
     assert _filter_tweet(self.tweet) is None
Beispiel #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
Beispiel #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))
Beispiel #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
Beispiel #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))
Beispiel #22
0
 def test_tweet_contains_firefox(self):
     self.tweet['text'] = 'My Firefox crashes :-( Any advice?'
     assert _filter_tweet(self.tweet) is not None
Beispiel #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))
Beispiel #24
0
 def test_username_does_not_contain_firefox(self):
     self.tweet['user']['screen_name'] = 'ilovefirefox4ever'
     assert _filter_tweet(self.tweet) is None
Beispiel #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))
Beispiel #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))
Beispiel #27
0
 def test_unfiltered(self):
     """Do not filter tweets without a reason."""
     eq_(self.tweet, _filter_tweet(self.tweet))
Beispiel #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
Beispiel #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))
Beispiel #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
Beispiel #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
Beispiel #32
0
 def test_tweet_contains_firefox(self):
     self.tweet['text'] = 'My Firefox crashes :-( Any advice?'
     assert _filter_tweet(self.tweet) is not None
Beispiel #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))
Beispiel #34
0
 def test_unfiltered(self):
     """Do not filter tweets without a reason."""
     eq_(self.tweet, _filter_tweet(self.tweet))
Beispiel #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
Beispiel #36
0
 def test_mentions(self):
     """Filter out mentions."""
     self.tweet['entities']['user_mentions'].append({'id': 123456})
     assert _filter_tweet(self.tweet) is None
Beispiel #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
Beispiel #38
0
 def test_mentions(self):
     """Filter out mentions."""
     self.tweet['text'] = 'Hey @someone!'
     assert _filter_tweet(self.tweet) is None