From 23b00fba3a6e5f2822bf57ab0d114d486fc4ff1f Mon Sep 17 00:00:00 2001 From: Evan Broder Date: Thu, 19 Mar 2009 12:42:51 -0400 Subject: [PATCH] Start a test suite. Signed-off-by: Evan Broder --- afs/tests/test__pts.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 afs/tests/__init__.py create mode 100644 afs/tests/test__pts.py diff --git a/afs/tests/__init__.py b/afs/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/afs/tests/test__pts.py b/afs/tests/test__pts.py new file mode 100644 index 0000000..d52a066 --- /dev/null +++ b/afs/tests/test__pts.py @@ -0,0 +1,24 @@ +import os +from afs._pts import PTS +import nose + +def get_this_cell(): + # Feel free to add more places ThisCell might show up + to_try = ['/private/var/db/openafs/etc/ThisCell', + '/etc/openafs/ThisCell', + '/usr/vice/etc/ThisCell'] + for f in to_try: + if os.path.isfile(f): + return open(f).read().strip() + +def test_init_home_cell(): + p = PTS() + assert p.cell == get_this_cell(), "PTS doesn't initialize to ThisCell when none specified." + +def test_init_other_cell(): + cell = 'zone.mit.edu' + p = PTS('zone.mit.edu') + assert p.cell == cell, "PTS doesn't initialize to provided cell." + +if __name__ == '__main__': + nose.main() -- 1.7.9.5