Move cursors tests into its own module.
authorJoshua Roesslein <jroesslein@gmail.com>
Mon, 10 Jun 2013 05:36:15 +0000 (22:36 -0700)
committerJoshua Roesslein <jroesslein@gmail.com>
Mon, 10 Jun 2013 05:36:42 +0000 (22:36 -0700)
.travis.yml
tests/test_api.py
tests/test_cursors.py [new file with mode: 0644]

index 6f8afb06f4d43e2cbaa4a40cbaea7f412c5d7735..18de21d8b380381dea6d42cfdf3b4da00685a6b4 100644 (file)
@@ -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:
index 65a37db78edd938436677c4f25ac6c13eb999f02..d2344884d1864ee7177e1d276a86c467e7f2935f 100644 (file)
@@ -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 (file)
index 0000000..cfcb9f1
--- /dev/null
@@ -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)
+