From: Evan Broder Date: Thu, 19 Mar 2009 16:55:34 +0000 (-0400) Subject: Add tests for PTS._NameToId, PTS._IdToName, and PTS._NameOrId. X-Git-Tag: 0.1.0~28 X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/python-afs.git/commitdiff_plain/d6f8af2738d1b43aae5073186c8de131dfe48ceb?ds=sidebyside Add tests for PTS._NameToId, PTS._IdToName, and PTS._NameOrId. Signed-off-by: Evan Broder --- 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()