Skip to content

Commit

Permalink
CI: Add test for proxy settings
Browse files Browse the repository at this point in the history
  • Loading branch information
ssahani committed Apr 22, 2021
1 parent a3b1048 commit 4b68f1d
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/network-config-manager-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1352,6 +1352,35 @@ def test_cli_configure_global_domain_server(self):

assert(parser.get('Resolve', 'Domains') == 'test1 test2')

class TestCLINetworkProxy:
def test_cli_configure_network_proxy(self):

if not os.path.exists("/etc/sysconfig/"):
os.mkdir("/etc/sysconfig/")

f = open("/etc/sysconfig/proxy", "w")
f.write("PROXY_ENABLED=\"no\"\nHTTP_PROXY=""\nHTTPS_PROXY=""\nNO_PROXY=\"localhost, 127.0.0.1\"\n")
f.close()

subprocess.check_call(['nmctl', 'set-proxy', 'enable', 'yes', 'http', 'http://test.com:123', 'https', 'https://test.com:123'])

dictionary = {}
file = open("/etc/sysconfig/proxy")

lines = file.read().split('\n')

for line in lines:
if line == '':
continue
pair = line.split('=')
dictionary[pair[0].strip('\'\'\"\"')] = pair[1].strip('\'\'\"\"')

assert(dictionary["HTTP_PROXY"] == "http://test.com:123")
assert(dictionary["HTTPS_PROXY"] == "https://test.com:123")
assert(dictionary["PROXY_ENABLED"] == "yes")

subprocess.check_call(['nmctl', 'set-proxy', 'enable', 'yes', 'http', 'http://test.com:123', 'ftp', 'https://test.com123'])

class TestWifiWPASupplicantConf:
yaml_configs = [
"name-password-wifi-dhcp.yaml",
Expand Down

0 comments on commit 4b68f1d

Please sign in to comment.