From b3a9cc06dbe59178ea370c4210adc3babf4532fd Mon Sep 17 00:00:00 2001 From: Joshua Roesslein Date: Sun, 9 Jun 2013 22:36:15 -0700 Subject: [PATCH] Move cursors tests into its own module. --- .travis.yml | 2 +- tests/test_api.py | 37 ------------------------------------- tests/test_cursors.py | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 38 deletions(-) create mode 100644 tests/test_cursors.py diff --git a/.travis.yml b/.travis.yml index 6f8afb0..18de21d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ --- -script: nosetests -v tests.test_api tests.test_streaming +script: nosetests -v tests.test_api tests.test_streaming tests.test_cursors language: python env: global: diff --git a/tests/test_api.py b/tests/test_api.py index 65a37db..d234488 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -312,43 +312,6 @@ class TweepyAPITests(unittest.TestCase): self.assertTrue(place_name_in_list('Austin, TX', self.api.reverse_geocode(lat=30.267370168467806, long= -97.74261474609375))) # Austin, TX, USA -class TweepyCursorTests(unittest.TestCase): - - def setUp(self): - auth = OAuthHandler(oauth_consumer_key, oauth_consumer_secret) - auth.set_access_token(oauth_token, oauth_token_secret) - self.api = API(auth) - 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_ids).items()) - self.assert_(len(items) > 0) - - items = list(Cursor(self.api.followers_ids, 'twitter').items(30)) - self.assert_(len(items) == 30) - - def testcursorcursorpages(self): - pages = list(Cursor(self.api.friends_ids).pages()) - self.assert_(len(pages) > 0) - - pages = list(Cursor(self.api.followers_ids, 'twitter').pages(5)) - self.assert_(len(pages) == 5) - class TweepyCacheTests(unittest.TestCase): timeout = 2.0 diff --git a/tests/test_cursors.py b/tests/test_cursors.py new file mode 100644 index 0000000..cfcb9f1 --- /dev/null +++ b/tests/test_cursors.py @@ -0,0 +1,35 @@ +import unittest + +from tweepy import API, Cursor + +from config import create_auth + +class TweepyCursorTests(unittest.TestCase): + + def setUp(self): + self.api = API(create_auth()) + self.api.retry_count = 2 + self.api.retry_delay = 5 + + def testidcursoritems(self): + items = list(Cursor(self.api.user_timeline).items(25)) + self.assertEqual(len(items), 25) + + def testidcursorpages(self): + pages = list(Cursor(self.api.user_timeline).pages(5)) + self.assertEqual(len(pages), 5) + + def testcursorcursoritems(self): + items = list(Cursor(self.api.friends_ids).items()) + self.assert_(len(items) > 0) + + items = list(Cursor(self.api.followers_ids, 'twitter').items(30)) + self.assert_(len(items) == 30) + + def testcursorcursorpages(self): + pages = list(Cursor(self.api.friends_ids).pages()) + self.assert_(len(pages) > 0) + + pages = list(Cursor(self.api.followers_ids, 'twitter').pages(5)) + self.assert_(len(pages) == 5) + -- 2.25.1