5 j = json.load(open(sys.argv[1]))
7 apiA = arvados.api(host=j["arvados_api_hosts"][0], token=j["superuser_tokens"][0], insecure=True)
8 apiB = arvados.api(host=j["arvados_api_hosts"][1], token=j["superuser_tokens"][1], insecure=True)
9 apiC = arvados.api(host=j["arvados_api_hosts"][2], token=j["superuser_tokens"][2], insecure=True)
12 ### Check users on API server "A" (the LoginCluster) ###
15 users = apiA.users().list().execute()
17 assert len(users["items"]) == 11
21 for i in range(1, 10):
23 for u in users["items"]:
24 if u["username"] == ("case%d" % i) and u["email"] == ("case%d@test" % i):
26 by_username[u["username"]] = u["uuid"]
30 for i in (1, 2, 3, 4, 5, 6, 7, 8):
32 for u in users["items"]:
33 if u["username"] == ("case%d" % i) and u["email"] == ("case%d@test" % i) and u["is_active"] is True:
35 assert found, "Not found case%i" % i
37 # case9 should not be active
39 for u in users["items"]:
40 if (u["username"] == "case9" and u["email"] == "case9@test" and
41 u["uuid"] == by_username[u["username"]] and u["is_active"] is False):
47 ### Check users on API server "B" (federation member) ###
49 users = apiB.users().list().execute()
50 assert len(users["items"]) == 11
54 for u in users["items"]:
55 if (u["username"] == ("case%d" % i) and u["email"] == ("case%d@test" % i) and
56 u["uuid"] == by_username[u["username"]] and u["is_active"] is True):
58 assert found, "Not found case%i" % i
61 for u in users["items"]:
62 if (u["username"] == "case9" and u["email"] == "case9@test" and
63 u["uuid"] == by_username[u["username"]] and u["is_active"] is False):
69 ### Check users on API server "C" (federation member) ###
71 users = apiC.users().list().execute()
72 assert len(users["items"]) == 8
74 for i in (2, 4, 6, 7, 8):
76 for u in users["items"]:
77 if (u["username"] == ("case%d" % i) and u["email"] == ("case%d@test" % i) and
78 u["uuid"] == by_username[u["username"]] and u["is_active"] is True):
82 # cases 3, 5, 9 involve users that have never accessed cluster C so
83 # there's nothing to migrate.
86 for u in users["items"]:
87 if (u["username"] == ("case%d" % i) and u["email"] == ("case%d@test" % i) and
88 u["uuid"] == by_username[u["username"]] and u["is_active"] is True):
92 print("Passed checks")