Skip to content

Commit b4945d0

Browse files
committed
imp: tests
1 parent 256dd13 commit b4945d0

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

tests/test_privoxy.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,23 @@ def test_https_no_verify(self, docker_privoxy, make_request):
2525
with pytest.raises(SSLError):
2626
make_request("https://google.com", use_privoxy_ca_bundle=False)
2727

28-
def test_adblock_filters(self, docker_privoxy, make_request):
28+
def test_http_adblock_filters(self, docker_privoxy, make_request):
2929
resp = make_request("http://googie-anaiytics.com")
3030
assert self._is_blocked_by_privoxy(resp) == True
31+
32+
def test_https_adblock_filters(self, docker_privoxy, make_request):
3133
resp = make_request("https://googie-anaiytics.com")
3234
assert self._is_blocked_by_privoxy(resp) == True
3335

34-
def test_no_adblock_filters(self):
36+
def test_http_no_adblock_filters(self):
3537
try:
3638
resp = requests.get("http://googie-anaiytics.com")
3739
assert self._is_blocked_by_privoxy(resp) == False
40+
except ConnectionError:
41+
pass # 99% blocked by external software
42+
43+
def test_https_no_adblock_filters(self):
44+
try:
3845
resp = requests.get("https://googie-anaiytics.com")
3946
assert self._is_blocked_by_privoxy(resp) == False
4047
except ConnectionError:
@@ -51,18 +58,26 @@ def test_https_adblock_css_filters(self, docker_privoxy, make_request, env_info)
5158
)
5259
assert resp.status_code == 200
5360

54-
def test_privman_blocklist(self, docker_privoxy, make_request, exec_privman):
61+
def test_http_privman_blocklist(self, docker_privoxy, make_request, exec_privman):
5562
resp = exec_privman(docker_privoxy, "--add-blocklist", ".google.")
5663
assert "successfully" in resp
5764
time.sleep(3)
5865
resp = make_request("http://google.com")
5966
assert self._is_blocked_by_privoxy(resp) == True
60-
resp = make_request("https://google.com")
61-
assert self._is_blocked_by_privoxy(resp) == True
6267
resp = exec_privman(docker_privoxy, "--remove-blocklist", ".google.")
6368
assert "successfully" in resp
6469
time.sleep(3)
6570
resp = make_request("http://google.com")
6671
assert resp.status_code == 200
72+
73+
def test_https_privman_blocklist(self, docker_privoxy, make_request, exec_privman):
74+
resp = exec_privman(docker_privoxy, "--add-blocklist", ".google.")
75+
assert "successfully" in resp
76+
time.sleep(3)
77+
resp = make_request("https://google.com")
78+
assert self._is_blocked_by_privoxy(resp) == True
79+
resp = exec_privman(docker_privoxy, "--remove-blocklist", ".google.")
80+
assert "successfully" in resp
81+
time.sleep(3)
6782
resp = make_request("https://google.com")
6883
assert resp.status_code == 200

0 commit comments

Comments
 (0)