Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_connect_pings():
with mock.patch('sys.argv', ['openpyn', 'au', '-p', '5', '--test']):
assert openpyn.main() == 0
def test_list():
with mock.patch('sys.argv', ['openpyn', '-l']):
assert openpyn.main() == 0
def test_list_country_area_state_p2p():
with mock.patch('sys.argv', ['openpyn', '-l', 'au', '--area', 'sa', '--p2p']):
assert openpyn.main() == 0
def test_list_tor():
with mock.patch('sys.argv', ['openpyn', '-l', '--tor']):
assert openpyn.main() == 0
def test_connect_country_code_arg():
with mock.patch('sys.argv', ['openpyn', '-c', 'au', '--test']):
assert openpyn.main() == 0
def test_connect_country_code():
with mock.patch('sys.argv', ['openpyn', 'au', '--test']):
assert openpyn.main() == 0
def test_connect_country_name():
with mock.patch('sys.argv', ['openpyn', 'australia', '--test']):
assert openpyn.main() == 0
def test_connect_top_servers():
with mock.patch('sys.argv', ['openpyn', 'au', '-t', '5', '--test']):
assert openpyn.main() == 0
def test_connect_max_load():
with mock.patch('sys.argv', ['openpyn', 'au', '-m', '50', '--test']):
assert openpyn.main() == 0
def update_config_files() -> None:
root.verify_root_access("Root access needed to write files in " +
"'" + __basefilepath__ + "files/" + "'")
try:
zip_archive = __basefilepath__ + "ovpn.zip"
if os.path.exists(zip_archive):
print(Fore.BLUE + "Previous update file already exists, deleting..." + Style.RESET_ALL)
os.remove(zip_archive)
subprocess.check_call(
["sudo", "wget", "https://downloads.nordcdn.com/configs/archives/servers/ovpn.zip", "-P", __basefilepath__])
except subprocess.CalledProcessError:
logger.error("Exception occurred while wgetting zip, is the internet working? \
is nordcdn.com blocked by your ISP or Country?, If so use Privoxy \
[https://github.com/jotyGill/openpyn-nordvpn/issues/109]")
sys.exit()
try:
subprocess.check_call(