skip OAuth tests when server is unreachable

This commit is contained in:
Mike Fährmann
2020-05-10 00:33:00 +02:00
parent f557cac074
commit 4b606b68e4

View File

@@ -14,6 +14,7 @@ import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from gallery_dl import oauth, text # noqa E402 from gallery_dl import oauth, text # noqa E402
TESTSERVER = "http://term.ie/oauth/example"
TESTSERVER = "http://term.ie/oauth/example" TESTSERVER = "http://term.ie/oauth/example"
CONSUMER_KEY = "key" CONSUMER_KEY = "key"
CONSUMER_SECRET = "secret" CONSUMER_SECRET = "secret"
@@ -99,8 +100,10 @@ class TestOAuthSession(unittest.TestCase):
CONSUMER_KEY, CONSUMER_SECRET, CONSUMER_KEY, CONSUMER_SECRET,
oauth_token, oauth_token_secret, oauth_token, oauth_token_secret,
) )
url = TESTSERVER + endpoint try:
return session.get(url, params=params).text return session.get(TESTSERVER + endpoint, params=params).text
except OSError:
raise unittest.SkipTest()
if __name__ == "__main__": if __name__ == "__main__":