X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/python-afs.git/blobdiff_plain/308ef708cf01eb727827da34a3f56bfb2f0538cf..d6f8af2738d1b43aae5073186c8de131dfe48ceb:/afs/tests/test__pts.py diff --git a/afs/tests/test__pts.py b/afs/tests/test__pts.py index d52a066..64297b1 100644 --- a/afs/tests/test__pts.py +++ b/afs/tests/test__pts.py @@ -20,5 +20,26 @@ def test_init_other_cell(): p = PTS('zone.mit.edu') assert p.cell == cell, "PTS doesn't initialize to provided cell." +def test_user_name_to_id(): + p = PTS() + name = 'broder' + id = p._NameToId(name) + assert id == 41803, "PTS can't convert user name to ID." + assert p._IdToName(id) == name, "PTS can't convert user ID to name." + +def test_group_name_to_id(): + p = PTS() + name = 'system:administrators' + id = p._NameToId(name) + assert id == -204, "PTS can't convert group name to ID." + assert p._IdToName(id) == name, "PTS can't convert group ID to name." + +def test_name_or_id(): + p = PTS() + name = 'system:administrators' + id = -204 + assert p._NameOrId(name) == id, "PTS._NameOrId can't identify name." + assert p._NameOrId(id) == id, "PTS._NameOrId can't identify ID." + if __name__ == '__main__': nose.main()