Exemplo n.º 1
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
Exemplo n.º 2
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
Exemplo n.º 3
0
    def setUp(self):
        # Set up some ignored users
        self.ignored_usernames = ['deanj', 'r1cky', 'mythmon']
        for username in self.ignored_usernames:
            twitter_account(username=username, ignored=True, save=True)

        # Now a few normal users
        self.normal_usernames = ['willkg', 'marcell', 'ian']
        for username in self.normal_usernames:
            twitter_account(username=username, ignored=False, save=True)

        # Create a user with permissions to ignore
        u = user(save=True)
        add_permission(u, TwitterAccount, 'ignore_account')
        self.client.login(username=u.username, password='******')
Exemplo n.º 4
0
    def test_post_account_not_banned(self):
        # Create a tweet so our request matches.
        Tweet.objects.create(pk=1,
                             raw_json='{}',
                             locale='en',
                             created=datetime.now())

        # Create a valid TwitterAccount
        twitter_account(username='******', banned=False, save=True)

        # Create a request and mock all the required properties and methods.
        request = self._create_mocked_tweet_request()

        twitter_post(request)
        eq_(request.twitter.api.update_status.called, True)
Exemplo n.º 5
0
    def setUp(self):
        # Set up some ignored users
        self.ignored_usernames = ['deanj', 'r1cky', 'mythmon']
        for username in self.ignored_usernames:
            twitter_account(username=username, ignored=True, save=True)

        # Now a few normal users
        self.normal_usernames = ['willkg', 'marcell', 'ian']
        for username in self.normal_usernames:
            twitter_account(username=username, ignored=False, save=True)

        # Create a user with permissions to ignore
        u = user(save=True)
        add_permission(u, TwitterAccount, 'ignore_account')
        self.client.login(username=u.username, password='******')
Exemplo n.º 6
0
    def test_post_account_not_banned(self):
        # Create a tweet so our request matches.
        Tweet.objects.create(
            pk=1,
            raw_json='{}',
            locale='en',
            created=datetime.now())

        # Create a valid TwitterAccount
        twitter_account(username='******', banned=False, save=True)

        # Create a request and mock all the required properties and methods.
        request = self._create_mocked_tweet_request()

        twitter_post(request)
        eq_(request.twitter.api.update_status.called, True)
Exemplo n.º 7
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
Exemplo n.º 8
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