Skip auth tests if consumer key and/or secret missing
authorHarmon <Harmon758@gmail.com>
Wed, 19 May 2021 15:38:22 +0000 (10:38 -0500)
committerHarmon <Harmon758@gmail.com>
Wed, 19 May 2021 15:38:22 +0000 (10:38 -0500)
tests/test_auth.py

index 5f875efb971b142ef5c71d630ffbdbe401c46fd5..aa7d77e449fa22204a6d1971ffeae7eed10836ad 100644 (file)
@@ -8,6 +8,9 @@ from tweepy import API, OAuthHandler
 class TweepyAuthTests(unittest.TestCase):
 
     def testoauth(self):
+        if not consumer_key or not consumer_secret:
+            self.skipTest("Missing consumer key and/or secret")
+
         auth = OAuthHandler(consumer_key, consumer_secret)
 
         # test getting access token
@@ -24,6 +27,9 @@ class TweepyAuthTests(unittest.TestCase):
         api.destroy_status(s.id)
 
     def testaccesstype(self):
+        if not consumer_key or not consumer_secret:
+            self.skipTest("Missing consumer key and/or secret")
+
         auth = OAuthHandler(consumer_key, consumer_secret)
         auth_url = auth.get_authorization_url(access_type='read')
         print('Please open: ' + auth_url)