From e19c9b292f01561591c6e8cfcfa4cc8dc980b8c1 Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Wed, 15 Jul 2026 15:31:48 +0530 Subject: [PATCH] test(amazon): cover sticky proxy country rewrite --- .../tests/unit/platforms/amazon/test_proxy.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/surfsense_backend/tests/unit/platforms/amazon/test_proxy.py b/surfsense_backend/tests/unit/platforms/amazon/test_proxy.py index 599bda67d..8302fd1cb 100644 --- a/surfsense_backend/tests/unit/platforms/amazon/test_proxy.py +++ b/surfsense_backend/tests/unit/platforms/amazon/test_proxy.py @@ -35,6 +35,19 @@ def test_dataimpulse_sticky_url_replaces_existing_session(monkeypatch): assert result.count("__sid.new") == 1 +def test_dataimpulse_sticky_url_rewrites_country(monkeypatch): + monkeypatch.setattr( + Config, + "PROXY_URL", + "http://token__cr.us:secret@gw.dataimpulse.com:823", + ) + + result = DataImpulseProvider().get_sticky_proxy_url("new", "gb") + + assert "token__cr.gb__sid.new" in result + assert "__cr.us" not in result + + def test_dataimpulse_sticky_url_rejects_empty_session(monkeypatch): monkeypatch.setattr( Config,