mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-20 23:21:06 +02:00
chore: linting
This commit is contained in:
parent
be35eb8743
commit
c0ebb62fb2
20 changed files with 158 additions and 125 deletions
|
|
@ -58,7 +58,9 @@ class TestGlobalCatalogHasUsableChat:
|
|||
"""Usability, not file existence, is what counts."""
|
||||
|
||||
def test_usable_when_enabled_connection_and_chat_model(self, monkeypatch):
|
||||
monkeypatch.setattr(mc.config, "GLOBAL_CONNECTIONS", [{"id": -1, "enabled": True}])
|
||||
monkeypatch.setattr(
|
||||
mc.config, "GLOBAL_CONNECTIONS", [{"id": -1, "enabled": True}]
|
||||
)
|
||||
monkeypatch.setattr(mc.config, "GLOBAL_MODELS", [_global_model()])
|
||||
assert mc._global_catalog_has_usable_chat() is True
|
||||
|
||||
|
|
@ -68,17 +70,23 @@ class TestGlobalCatalogHasUsableChat:
|
|||
assert mc._global_catalog_has_usable_chat() is False
|
||||
|
||||
def test_disabled_connection_is_not_usable(self, monkeypatch):
|
||||
monkeypatch.setattr(mc.config, "GLOBAL_CONNECTIONS", [{"id": -1, "enabled": False}])
|
||||
monkeypatch.setattr(
|
||||
mc.config, "GLOBAL_CONNECTIONS", [{"id": -1, "enabled": False}]
|
||||
)
|
||||
monkeypatch.setattr(mc.config, "GLOBAL_MODELS", [_global_model()])
|
||||
assert mc._global_catalog_has_usable_chat() is False
|
||||
|
||||
def test_disabled_model_is_not_usable(self, monkeypatch):
|
||||
monkeypatch.setattr(mc.config, "GLOBAL_CONNECTIONS", [{"id": -1, "enabled": True}])
|
||||
monkeypatch.setattr(
|
||||
mc.config, "GLOBAL_CONNECTIONS", [{"id": -1, "enabled": True}]
|
||||
)
|
||||
monkeypatch.setattr(mc.config, "GLOBAL_MODELS", [_global_model(enabled=False)])
|
||||
assert mc._global_catalog_has_usable_chat() is False
|
||||
|
||||
def test_non_chat_model_is_not_usable(self, monkeypatch):
|
||||
monkeypatch.setattr(mc.config, "GLOBAL_CONNECTIONS", [{"id": -1, "enabled": True}])
|
||||
monkeypatch.setattr(
|
||||
mc.config, "GLOBAL_CONNECTIONS", [{"id": -1, "enabled": True}]
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
mc.config, "GLOBAL_MODELS", [_global_model(supports_chat=False)]
|
||||
)
|
||||
|
|
|
|||
|
|
@ -37,7 +37,10 @@ def test_proxy_login_form_strips_scheme():
|
|||
|
||||
|
||||
def test_proxy_login_form_without_credentials():
|
||||
assert solvers.proxy_login_form("http://gw.dataimpulse.com:823") == "gw.dataimpulse.com:823"
|
||||
assert (
|
||||
solvers.proxy_login_form("http://gw.dataimpulse.com:823")
|
||||
== "gw.dataimpulse.com:823"
|
||||
)
|
||||
|
||||
|
||||
def test_proxy_login_form_none_on_missing_or_bad():
|
||||
|
|
@ -54,7 +57,10 @@ def test_capsolver_proxy_colon_delimited_with_creds():
|
|||
|
||||
|
||||
def test_capsolver_proxy_without_credentials():
|
||||
assert solvers.capsolver_proxy("http://gw.dataimpulse.com:823") == "http:gw.dataimpulse.com:823"
|
||||
assert (
|
||||
solvers.capsolver_proxy("http://gw.dataimpulse.com:823")
|
||||
== "http:gw.dataimpulse.com:823"
|
||||
)
|
||||
|
||||
|
||||
def test_capsolver_proxy_none_on_missing_or_bad():
|
||||
|
|
@ -68,14 +74,14 @@ def test_capsolver_proxy_none_on_missing_or_bad():
|
|||
def test_unsupported_provider_raises_solvererror():
|
||||
# An unconfigured provider must fail loudly (latch) rather than POST the key
|
||||
# to a wired vendor's endpoint under the wrong account.
|
||||
with pytest.raises(solvers.SolverUnsupported):
|
||||
with pytest.raises(solvers.SolverUnsupportedError):
|
||||
solvers.solve(
|
||||
_cfg(solving_site="anticaptcha"),
|
||||
challenge_type="v2",
|
||||
sitekey="SK",
|
||||
page_url="https://t.test",
|
||||
)
|
||||
assert issubclass(solvers.SolverUnsupported, solvers.SolverError)
|
||||
assert issubclass(solvers.SolverUnsupportedError, solvers.SolverError)
|
||||
|
||||
|
||||
def test_wired_providers_are_registered():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue