X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=test%2Fintegration%2Fcmd_join.py;h=bfc1f1974b9b3de79b2b4ac04aa70879081a1e09;hb=66eb66ec8f872db3dc12e1d01101772918d69a4a;hp=585afeed7f1a891ac3539ab4ce5a0afe163e85ce;hpb=b4280adda649c177ad27349fad4d51c2ebd9d35d;p=tinc diff --git a/test/integration/cmd_join.py b/test/integration/cmd_join.py index 585afeed..bfc1f197 100755 --- a/test/integration/cmd_join.py +++ b/test/integration/cmd_join.py @@ -7,6 +7,7 @@ import shutil from testlib import check, util from testlib.log import log +from testlib.const import RUN_ACCESS_CHECKS from testlib.proc import Tinc from testlib.test import Test @@ -77,19 +78,19 @@ def test_invite_errors(foo: Tinc) -> None: _, err = foo.cmd("invite", foo.name, code=1) check.is_in("already exists", err) - if os.name != "nt": + if RUN_ACCESS_CHECKS: + log.info("bad permissions on invitations are fixed") invites = foo.sub("invitations") os.chmod(invites, 0) - _, err = foo.cmd("invite", "foobar", code=1) - check.is_in("Could not read directory", err) - os.chmod(invites, 0o750) + out, _ = foo.cmd("invite", "foobar") + check.has_prefix(out, "localhost:") - log.info("block creating invitations directory") - shutil.rmtree(foo.sub("invitations")) + log.info("invitations directory is created with bad permissions on parent") + shutil.rmtree(invites) os.chmod(foo.work_dir, 0o500) - _, err = foo.cmd("invite", "foobar", code=1) - check.is_in("Could not create directory", err) - os.chmod(foo.work_dir, 0o750) + out, _ = foo.cmd("invite", "foobar") + check.has_prefix(out, "localhost:") + check.true(os.access(invites, os.W_OK)) log.info("fully block access to configuration directory") work_dir = foo.sub("test_no_access") @@ -121,12 +122,13 @@ def test_join_errors(foo: Tinc) -> None: _, err = foo.cmd("-c", work_dir, "join", FAKE_INVITE, code=1) check.is_in("Could not connect to", err) - if os.name != "nt": - log.info("test working without access to configuration directory") + if RUN_ACCESS_CHECKS: + log.info("bad permissions on configuration directory are fixed") work_dir = foo.sub("wd_access_test") os.mkdir(work_dir, mode=400) _, err = foo.cmd("-c", work_dir, "join", FAKE_INVITE, code=1) - check.is_in("No permission to write", err) + check.is_in("Could not connect to", err) + check.true(os.access(work_dir, mode=os.W_OK)) with Test("run invite success tests") as context: