upgrade permsets in smoketest

This commit is contained in:
ed 2021-08-14 22:45:33 +02:00
parent 638b05a49a
commit af2d0b8421

View file

@ -108,6 +108,7 @@ def tc1():
pdirs = [x.replace("\\", "/") for x in pdirs] pdirs = [x.replace("\\", "/") for x in pdirs]
udirs = [x.split("/", 2)[2] for x in pdirs] udirs = [x.split("/", 2)[2] for x in pdirs]
perms = [x.rstrip("j/")[-1] for x in pdirs] perms = [x.rstrip("j/")[-1] for x in pdirs]
perms = ["rw" if x == "a" else x for x in perms]
for pd, ud, p in zip(pdirs, udirs, perms): for pd, ud, p in zip(pdirs, udirs, perms):
if ud[-1] == "j": if ud[-1] == "j":
continue continue
@ -147,14 +148,14 @@ def tc1():
u = "{}{}/a.h264".format(ub, d) u = "{}{}/a.h264".format(ub, d)
r = requests.get(u) r = requests.get(u)
ok = bool(r) ok = bool(r)
if ok != (p in ["a"]): if ok != (p in ["rw"]):
raise Exception("get {} with perm {} at {}".format(ok, p, u)) raise Exception("get {} with perm {} at {}".format(ok, p, u))
# stat filesystem # stat filesystem
for d, p in zip(pdirs, perms): for d, p in zip(pdirs, perms):
u = "{}/a.h264".format(d) u = "{}/a.h264".format(d)
ok = os.path.exists(u) ok = os.path.exists(u)
if ok != (p in ["a", "w"]): if ok != (p in ["rw", "w"]):
raise Exception("stat {} with perm {} at {}".format(ok, p, u)) raise Exception("stat {} with perm {} at {}".format(ok, p, u))
# GET thumbnail, vreify contents # GET thumbnail, vreify contents
@ -162,7 +163,7 @@ def tc1():
u = "{}{}/a.h264?th=j".format(ub, d) u = "{}{}/a.h264?th=j".format(ub, d)
r = requests.get(u) r = requests.get(u)
ok = bool(r and r.content[:3] == b"\xff\xd8\xff") ok = bool(r and r.content[:3] == b"\xff\xd8\xff")
if ok != (p in ["a"]): if ok != (p in ["rw"]):
raise Exception("thumb {} with perm {} at {}".format(ok, p, u)) raise Exception("thumb {} with perm {} at {}".format(ok, p, u))
# check tags # check tags
@ -179,10 +180,10 @@ def tc1():
r_ok = bool(j) r_ok = bool(j)
w_ok = bool(r_ok and j.get("files")) w_ok = bool(r_ok and j.get("files"))
if not r_ok or w_ok != (p in ["a"]): if not r_ok or w_ok != (p in ["rw"]):
raise Exception("ls {} with perm {} at {}".format(ok, p, u)) raise Exception("ls {} with perm {} at {}".format(ok, p, u))
if (tag and p != "a") or (not tag and p == "a"): if (tag and p != "rw") or (not tag and p == "rw"):
raise Exception("tag {} with perm {} at {}".format(tag, p, u)) raise Exception("tag {} with perm {} at {}".format(tag, p, u))
if tag is not None and tag != "48x32": if tag is not None and tag != "48x32":