twython/tests/test_streaming.py
Mike Helmick 7cab9d5dd1 Attempting to exclude lines that we can't necessarily hit in tests, added a test, fixed function name
update_profile_background_image has been in endpoints.py twice for a
bit, my bad.

Using update_profile_banner_image for the function name to update
profile banner image (that's what it was called previously)
2013-06-12 10:54:28 -04:00

37 lines
1.1 KiB
Python

from twython import TwythonStreamer, TwythonStreamError
from .config import (
app_key, app_secret, oauth_token, oauth_token_secret
)
import unittest
class TwythonStreamTestCase(unittest.TestCase):
def setUp(self):
class MyStreamer(TwythonStreamer):
def on_success(self, data):
self.disconnect()
def on_error(self, status_code, data):
raise TwythonStreamError(data)
self.api = MyStreamer(app_key, app_secret,
oauth_token, oauth_token_secret)
def test_stream_status_filter(self):
self.api.statuses.filter(track='twitter')
def test_stream_status_sample(self):
self.api.statuses.sample()
def test_stream_status_firehose(self):
self.assertRaises(TwythonStreamError, self.api.statuses.firehose,
track='twitter')
def test_stream_site(self):
self.assertRaises(TwythonStreamError, self.api.site,
follow='twitter')
def test_stream_user(self):
self.api.user(track='twitter')