skip OAuth tests when server is unreachable
This commit is contained in:
@@ -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__":
|
||||||
|
|||||||
Reference in New Issue
Block a user