d52a0667aacaea09f4dd84fe01946b801c81bd94
[invirt/packages/python-afs.git] / afs / tests / test__pts.py
1 import os
2 from afs._pts import PTS
3 import nose
4
5 def get_this_cell():
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']
10     for f in to_try:
11         if os.path.isfile(f):
12             return open(f).read().strip()
13
14 def test_init_home_cell():
15     p = PTS()
16     assert p.cell == get_this_cell(), "PTS doesn't initialize to ThisCell when none specified."
17
18 def test_init_other_cell():
19     cell = 'zone.mit.edu'
20     p = PTS('zone.mit.edu')
21     assert p.cell == cell, "PTS doesn't initialize to provided cell."
22
23 if __name__ == '__main__':
24     nose.main()