-
Notifications
You must be signed in to change notification settings - Fork 45
/
test_dns6.py
82 lines (56 loc) · 2.43 KB
/
test_dns6.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import random
import pytest
import sh
import lib
from lib import daemon, dns, info, logging, login, settings
def setup_module(module): # noqa: ARG001
daemon.start()
login.login_as("default")
def teardown_module(module): # noqa: ARG001
sh.nordvpn.logout("--persist-token")
daemon.stop()
def setup_function(function): # noqa: ARG001
logging.log()
# Make sure that Custom DNS, IPv6 and Threat Protection Lite are disabled before we execute each test
lib.set_dns("off")
lib.set_ipv6("off")
lib.set_threat_protection_lite("off")
def teardown_function(function): # noqa: ARG001
logging.log(data=info.collect())
logging.log()
@pytest.mark.parametrize("threat_protection_lite", lib.THREAT_PROTECTION_LITE)
@pytest.mark.parametrize(("tech", "proto", "obfuscated"), lib.OVPN_STANDARD_TECHNOLOGIES)
def test_dns_connect(tech, proto, obfuscated, threat_protection_lite):
lib.set_technology_and_protocol(tech, proto, obfuscated)
lib.set_threat_protection_lite(threat_protection_lite)
lib.set_ipv6("on")
assert dns.is_unset()
with lib.Defer(sh.nordvpn.disconnect):
sh.nordvpn.connect(random.choice(lib.IPV6_SERVERS))
if threat_protection_lite == "on":
assert settings.is_tpl_enabled()
assert settings.dns_visible_in_settings(["disabled"])
assert dns.is_set_for(dns.DNS_TPL_IPV6 + dns.DNS_TPL)
else:
assert not settings.is_tpl_enabled()
assert settings.dns_visible_in_settings(["disabled"])
assert dns.is_set_for(dns.DNS_NORD_IPV6 + dns.DNS_NORD)
assert dns.is_unset()
@pytest.mark.parametrize(("tech", "proto", "obfuscated"), lib.OVPN_STANDARD_TECHNOLOGIES)
def test_set_dns_connected(tech, proto, obfuscated):
lib.set_technology_and_protocol(tech, proto, obfuscated)
# TODO: LVPN-1349
sh.nordvpn.connect()
sh.nordvpn.disconnect()
lib.set_ipv6("on")
assert dns.is_unset()
with lib.Defer(sh.nordvpn.disconnect):
sh.nordvpn.connect(random.choice(lib.IPV6_SERVERS))
assert not settings.is_tpl_enabled()
assert settings.dns_visible_in_settings(["disabled"])
assert dns.is_set_for(dns.DNS_NORD_IPV6 + dns.DNS_NORD)
lib.set_threat_protection_lite("on")
assert settings.is_tpl_enabled()
assert settings.dns_visible_in_settings(["disabled"])
assert dns.is_set_for(dns.DNS_TPL_IPV6 + dns.DNS_TPL)
assert dns.is_unset()