Skip to content

Commit b3a9cc0

Browse files
committed
Move cursors tests into its own module.
1 parent 40adbd9 commit b3a9cc0

File tree

3 files changed

+36
-38
lines changed

3 files changed

+36
-38
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
script: nosetests -v tests.test_api tests.test_streaming
2+
script: nosetests -v tests.test_api tests.test_streaming tests.test_cursors
33
language: python
44
env:
55
global:

tests/test_api.py

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -312,43 +312,6 @@ def place_name_in_list(place_name, place_list):
312312
self.assertTrue(place_name_in_list('Austin, TX',
313313
self.api.reverse_geocode(lat=30.267370168467806, long= -97.74261474609375))) # Austin, TX, USA
314314

315-
class TweepyCursorTests(unittest.TestCase):
316-
317-
def setUp(self):
318-
auth = OAuthHandler(oauth_consumer_key, oauth_consumer_secret)
319-
auth.set_access_token(oauth_token, oauth_token_secret)
320-
self.api = API(auth)
321-
self.api.retry_count = 2
322-
self.api.retry_delay = 5
323-
324-
def testpagecursoritems(self):
325-
items = list(Cursor(self.api.user_timeline).items())
326-
self.assert_(len(items) > 0)
327-
328-
items = list(Cursor(self.api.user_timeline, 'twitter').items(30))
329-
self.assert_(len(items) == 30)
330-
331-
def testpagecursorpages(self):
332-
pages = list(Cursor(self.api.user_timeline).pages())
333-
self.assert_(len(pages) > 0)
334-
335-
pages = list(Cursor(self.api.user_timeline, 'twitter').pages(5))
336-
self.assert_(len(pages) == 5)
337-
338-
def testcursorcursoritems(self):
339-
items = list(Cursor(self.api.friends_ids).items())
340-
self.assert_(len(items) > 0)
341-
342-
items = list(Cursor(self.api.followers_ids, 'twitter').items(30))
343-
self.assert_(len(items) == 30)
344-
345-
def testcursorcursorpages(self):
346-
pages = list(Cursor(self.api.friends_ids).pages())
347-
self.assert_(len(pages) > 0)
348-
349-
pages = list(Cursor(self.api.followers_ids, 'twitter').pages(5))
350-
self.assert_(len(pages) == 5)
351-
352315
class TweepyCacheTests(unittest.TestCase):
353316

354317
timeout = 2.0

tests/test_cursors.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import unittest
2+
3+
from tweepy import API, Cursor
4+
5+
from config import create_auth
6+
7+
class TweepyCursorTests(unittest.TestCase):
8+
9+
def setUp(self):
10+
self.api = API(create_auth())
11+
self.api.retry_count = 2
12+
self.api.retry_delay = 5
13+
14+
def testidcursoritems(self):
15+
items = list(Cursor(self.api.user_timeline).items(25))
16+
self.assertEqual(len(items), 25)
17+
18+
def testidcursorpages(self):
19+
pages = list(Cursor(self.api.user_timeline).pages(5))
20+
self.assertEqual(len(pages), 5)
21+
22+
def testcursorcursoritems(self):
23+
items = list(Cursor(self.api.friends_ids).items())
24+
self.assert_(len(items) > 0)
25+
26+
items = list(Cursor(self.api.followers_ids, 'twitter').items(30))
27+
self.assert_(len(items) == 30)
28+
29+
def testcursorcursorpages(self):
30+
pages = list(Cursor(self.api.friends_ids).pages())
31+
self.assert_(len(pages) > 0)
32+
33+
pages = list(Cursor(self.api.followers_ids, 'twitter').pages(5))
34+
self.assert_(len(pages) == 5)
35+

0 commit comments

Comments
 (0)