2 from afs._pts import PTS
6 # Feel free to add more places ThisCell might show up
7 to_try = ['/private/var/db/openafs/etc/ThisCell',
8 '/etc/openafs/ThisCell',
9 '/usr/vice/etc/ThisCell']
12 return open(f).read().strip()
14 def test_init_home_cell():
16 assert p.cell == get_this_cell(), "PTS doesn't initialize to ThisCell when none specified."
18 def test_init_other_cell():
20 p = PTS('zone.mit.edu')
21 assert p.cell == cell, "PTS doesn't initialize to provided cell."
23 def test_user_name_to_id():
26 id = p._NameToId(name)
27 assert id == 41803, "PTS can't convert user name to ID."
28 assert p._IdToName(id) == name, "PTS can't convert user ID to name."
30 def test_group_name_to_id():
32 name = 'system:administrators'
33 id = p._NameToId(name)
34 assert id == -204, "PTS can't convert group name to ID."
35 assert p._IdToName(id) == name, "PTS can't convert group ID to name."
37 def test_name_or_id():
39 name = 'system:administrators'
41 assert p._NameOrId(name) == id, "PTS._NameOrId can't identify name."
42 assert p._NameOrId(id) == id, "PTS._NameOrId can't identify ID."
44 if __name__ == '__main__':