[tests] implement explicitly disabling auth
This commit is contained in:
@@ -487,11 +487,8 @@ You’ll be able to receive four Galarian form Pokémon with Hidden Abilities, p
|
|||||||
"#comment" : "age-restricted (#2354)",
|
"#comment" : "age-restricted (#2354)",
|
||||||
"#category": ("", "twitter", "tweet"),
|
"#category": ("", "twitter", "tweet"),
|
||||||
"#class" : twitter.TwitterTweetExtractor,
|
"#class" : twitter.TwitterTweetExtractor,
|
||||||
|
"#auth" : False,
|
||||||
"#exception": exception.AuthorizationError,
|
"#exception": exception.AuthorizationError,
|
||||||
"#options" : {"syndication": True},
|
|
||||||
"#count" : 1,
|
|
||||||
|
|
||||||
"date": "dt:2022-02-13 20:10:09",
|
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -49,6 +49,14 @@ AUTH = {
|
|||||||
"twitter",
|
"twitter",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AUTH_CONFIG = (
|
||||||
|
"username",
|
||||||
|
"cookies",
|
||||||
|
"api-key",
|
||||||
|
"client-id",
|
||||||
|
"refresh-token",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class TestExtractorResults(unittest.TestCase):
|
class TestExtractorResults(unittest.TestCase):
|
||||||
|
|
||||||
@@ -88,14 +96,16 @@ class TestExtractorResults(unittest.TestCase):
|
|||||||
key = key.split(".")
|
key = key.split(".")
|
||||||
config.set(key[:-1], key[-1], value)
|
config.set(key[:-1], key[-1], value)
|
||||||
|
|
||||||
requires_auth = result.get("#auth")
|
auth = result.get("#auth")
|
||||||
if requires_auth is None:
|
if auth is None:
|
||||||
requires_auth = (result["#category"][1] in AUTH)
|
auth = (result["#category"][1] in AUTH)
|
||||||
if requires_auth:
|
elif not auth:
|
||||||
|
for key in AUTH_CONFIG:
|
||||||
|
config.set((), key, None)
|
||||||
|
|
||||||
|
if auth:
|
||||||
extr = result["#class"].from_url(result["#url"])
|
extr = result["#class"].from_url(result["#url"])
|
||||||
if not any(extr.config(key) for key in (
|
if not any(extr.config(key) for key in AUTH_CONFIG):
|
||||||
"username", "cookies", "api-key", "client-id",
|
|
||||||
"refresh-token")):
|
|
||||||
msg = "no auth"
|
msg = "no auth"
|
||||||
self._skipped.append((result["#url"], msg))
|
self._skipped.append((result["#url"], msg))
|
||||||
self.skipTest(msg)
|
self.skipTest(msg)
|
||||||
|
|||||||
Reference in New Issue
Block a user