skip external OAuth tests (closes #908)
This commit is contained in:
@@ -14,7 +14,6 @@ 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"
|
||||||
@@ -96,12 +95,17 @@ class TestOAuthSession(unittest.TestCase):
|
|||||||
|
|
||||||
def _oauth_request(self, endpoint, params=None,
|
def _oauth_request(self, endpoint, params=None,
|
||||||
oauth_token=None, oauth_token_secret=None):
|
oauth_token=None, oauth_token_secret=None):
|
||||||
|
# the test server at 'term.ie' is unreachable
|
||||||
|
raise unittest.SkipTest()
|
||||||
|
|
||||||
session = oauth.OAuth1Session(
|
session = oauth.OAuth1Session(
|
||||||
CONSUMER_KEY, CONSUMER_SECRET,
|
CONSUMER_KEY, CONSUMER_SECRET,
|
||||||
oauth_token, oauth_token_secret,
|
oauth_token, oauth_token_secret,
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
return session.get(TESTSERVER + endpoint, params=params).text
|
response = session.get(TESTSERVER + endpoint, params=params)
|
||||||
|
response.raise_for_status()
|
||||||
|
return response.text
|
||||||
except OSError:
|
except OSError:
|
||||||
raise unittest.SkipTest()
|
raise unittest.SkipTest()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user