mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-12-06 07:55:10 +00:00
test: delete slow, timing-based and redundant tests
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from types import SimpleNamespace
|
||||
from typing import Any
|
||||
|
||||
@@ -74,31 +73,6 @@ def test_search_sends_no_login(server_accounts: Any, anonymous: bool) -> None:
|
||||
assert client.sent == {"endpoint": "/api/search", "service": "TEST", "query": "query"}
|
||||
|
||||
|
||||
@pytest.mark.parametrize("proxy", [None, "http://127.0.0.1:8080"])
|
||||
def test_local_proxy_sends_the_server_a_tunnel(monkeypatch: pytest.MonkeyPatch, proxy: str | None) -> None:
|
||||
class FakeTunnel:
|
||||
def __init__(self, server_url: str, headers: dict, exit_proxy: str | None = None) -> None:
|
||||
self.id = "abc"
|
||||
self.exit_proxy = exit_proxy
|
||||
|
||||
def start(self) -> str:
|
||||
return self.id
|
||||
|
||||
def stop(self) -> None:
|
||||
self.stopped = True
|
||||
|
||||
monkeypatch.setattr(remote_service, "TunnelClient", FakeTunnel)
|
||||
svc, client, _ = make_service({"local_proxy": True, "proxy": proxy})
|
||||
svc.log = logging.getLogger("test")
|
||||
client.session = SimpleNamespace(headers={"X-Secret-Key": "k"}) # type: ignore[attr-defined]
|
||||
|
||||
list(svc.search())
|
||||
|
||||
assert client.sent["proxy"] == "tunnel:abc"
|
||||
assert client.tunnel.exit_proxy == proxy
|
||||
assert client.tunnel.stopped
|
||||
|
||||
|
||||
def test_a_loopback_proxy_points_to_local_proxy(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
import click
|
||||
|
||||
|
||||
Reference in New Issue
Block a user