Commit 1add26e6 authored by Josh Roesslein's avatar Josh Roesslein
Browse files

Add tests for Cursors.

parent 746df900
......@@ -20,7 +20,7 @@ during upgrade will be listed here.
+ Fix search result 'source' parsing to properly unescape html and extract source
+ Cursor
Added the Cursor object to help with pagination within the API.
Please see the pagination tutorial for more details.
Please see the pagination tutorial for more details (tutorial/t6).
This is the recommended way for using the 'page' and 'cursor' parameters.
+ Update OAuth bundled library.
- Logging removed. Having our own mini-logging system just feels like overkill.
......
......@@ -203,6 +203,40 @@ class TweepyAPITests(unittest.TestCase):
self.api.trends_daily()
self.api.trends_weekly()
class TweepyCursorTests(unittest.TestCase):
def setUp(self):
self.api = API(BasicAuthHandler(username, password))
self.api.retry_count = 2
self.api.retry_delay = 5
def testpagecursoritems(self):
items = list(Cursor(self.api.user_timeline).items())
self.assert_(len(items) > 0)
items = list(Cursor(self.api.user_timeline, 'twitter').items(30))
self.assert_(len(items) == 30)
def testpagecursorpages(self):
pages = list(Cursor(self.api.user_timeline).pages())
self.assert_(len(pages) > 0)
pages = list(Cursor(self.api.user_timeline, 'twitter').pages(5))
self.assert_(len(pages) == 5)
def testcursorcursoritems(self):
items = list(Cursor(self.api.friends).items())
self.assert_(len(items) > 0)
items = list(Cursor(self.api.followers, 'twitter').items(30))
self.assert_(len(items) == 30)
def testcursorcursorpages(self):
pages = list(Cursor(self.api.friends).pages())
self.assert_(len(pages) > 0)
pages = list(Cursor(self.api.followers, 'twitter').pages(5))
self.assert_(len(pages) == 5)
class TweepyAuthTests(unittest.TestCase):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment