4 from hierarchy import *
7 BASEDIR = "test_hierarchy"
8 PURGE_BASEDIR = "rm -rf test_hierarchy"
10 class TestHierarchy(unittest.TestCase):
12 os.system(PURGE_BASEDIR)
16 h = Hierarchy(BASEDIR)
18 def testGetAuthInfo(self):
19 h = Hierarchy(BASEDIR)
21 name = "planetlab.us.arizona.stork"
23 self.assertEqual(h.auth_exists(name), False)
25 self.assertRaises(MissingAuthority, h.get_auth_info, name)
27 h.create_auth(name, create_parents=True)
28 auth_info = h.get_auth_info(name)
29 self.assert_(auth_info)
31 gid = auth_info.get_gid_object()
33 self.assertEqual(gid.get_subject(), name)
35 pubkey = auth_info.get_pkey_object()
38 # try to get it again, make sure it's still there
39 auth_info2 = h.get_auth_info(name)
40 self.assert_(auth_info2)
42 gid = auth_info2.get_gid_object()
44 self.assertEqual(gid.get_subject(), name)
46 pubkey = auth_info2.get_pkey_object()
50 if __name__ == "__main__":