diff options
author | Tobias K <6317548+theCalcaholic@users.noreply.github.com> | 2021-07-07 16:41:30 +0300 |
---|---|---|
committer | Tobias K <6317548+theCalcaholic@users.noreply.github.com> | 2021-07-07 16:41:30 +0300 |
commit | 33067ddfde684a7a62701d066175252aa5a2eafe (patch) | |
tree | e1cdb107e2fca86ca69eea61aeff27c54793bf25 /tests/nextcloud_tests.py | |
parent | 7b809d114b06c761d3662a8eb1c734b43503b688 (diff) |
activation_tests, nextcloud_tests: Make ports configurable
Diffstat (limited to 'tests/nextcloud_tests.py')
-rwxr-xr-x | tests/nextcloud_tests.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/nextcloud_tests.py b/tests/nextcloud_tests.py index c4346bfe..f68d9c81 100755 --- a/tests/nextcloud_tests.py +++ b/tests/nextcloud_tests.py @@ -29,6 +29,7 @@ suite_name = "nextcloud tests" test_cfg = 'test_cfg.txt' test_log = 'test_log.txt' + class tc: "terminal colors" brown='\033[33m' @@ -37,6 +38,7 @@ class tc: red='\033[31m' normal='\033[0m' + class Test: title = "test" @@ -67,22 +69,25 @@ class Test: with open(test_log, 'w') as logfile: config.write(logfile) + def usage(): "Print usage" print("usage: nextcloud_tests.py [--new] [ip]") print("--new removes saved configuration") + def signal_handler(sig, frame): sys.exit(0) -def test_nextcloud(IP): + +def test_nextcloud(IP, nc_port): """ Login and assert admin page checks""" test = Test() driver = webdriver.Firefox(service_log_path='/dev/null') driver.implicitly_wait(60) test.new("nextcloud page") try: - driver.get("https://" + IP + "/index.php/settings/admin/overview") + driver.get(f"https://{IP}:{nc_port}/index.php/settings/admin/overview") except: test.check(False) print(tc.red + "error:" + tc.normal + " unable to reach " + tc.yellow + IP + tc.normal) @@ -107,6 +112,7 @@ def test_nextcloud(IP): driver.close() + if __name__ == "__main__": signal.signal(signal.SIGINT, signal_handler) @@ -155,9 +161,10 @@ if __name__ == "__main__": # test IP = args[0] if len(args) > 0 else 'localhost' + nc_port = args[1] if len(args) > 1 else "443" print("Nextcloud tests " + tc.yellow + IP + tc.normal) print("---------------------------") - test_nextcloud(IP) + test_nextcloud(IP, nc_port) # License # |