X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=tests%2FtestXrn.py;h=bb751831cec38afb194bad619c019603d15731bb;hb=1ad73fcc7e39fc2dbf42e0de0e25b4d1178db517;hp=9725652d7b481b1e803cf848fe1fb3d2879397de;hpb=ba2aaa438f939a4b5c697052e37b1c3218901319;p=sfa.git diff --git a/tests/testXrn.py b/tests/testXrn.py index 9725652d..bb751831 100755 --- a/tests/testXrn.py +++ b/tests/testXrn.py @@ -13,10 +13,10 @@ class TestXrn(unittest.TestCase): def __hrn(self,h,t,exp_urn): if verbose: print 'testing (',h,t,') expecting',exp_urn if exp_urn: - xrn=Xrn(hrn=h,type=t) + xrn=Xrn(h,type=t) if verbose: print xrn.dump_string() urn=xrn.get_urn() - (h1,t1) = Xrn(urn=urn).get_hrn_type() + (h1,t1) = Xrn(urn).get_hrn_type() if h1!=h or t1!=t or urn!=exp_urn: print "hrn->urn->hrn : MISMATCH with in=(%s,%s) -- out=(%s,%s) -- urn=%s"%(h,t,h1,t1,urn) self.assertEqual(h1,h) @@ -25,9 +25,9 @@ class TestXrn(unittest.TestCase): else: # could not figure how to use assertFails on object construction.. # with self.assertRaises(SfaAPIError): - # Xrn(hrn=h,type=t).get_urn() + # Xrn(h,type=t).get_urn() try: - Xrn(hrn=h,type=t).get_urn() + Xrn(h,type=t).get_urn() failure="Unexpectedly created Xrn object" except SfaAPIError: failure=False @@ -56,10 +56,10 @@ class TestXrn(unittest.TestCase): def test_hrn006(self): self.__hrn("plc.princeton.tmack", 'user', "urn:publicid:IDN+plc:princeton+user+tmack" ) - def test_hrn007(self): - # not providing a type is currently not supporte - self.__hrn("fake-pi1@onelab.eu",None, - None) +# def test_hrn007(self): +# # not providing a type is currently not supporte +# self.__hrn("fake-pi1@onelab.eu",None, +# None) def test_hrn008(self): self.__hrn("plc.princeton.planetlab1", 'node', "urn:publicid:IDN+plc:princeton+node+planetlab1" ) @@ -69,7 +69,19 @@ class TestXrn(unittest.TestCase): def test_hrn010(self): self.__hrn("plc.vini.site", 'authority', "urn:publicid:IDN+plc:vini:site+authority+sa" ) - + + # this one is a bit off limits but it's used in some places + # like .e.g when running sfi.py resources + def test_void(self): + void=Xrn(xrn='',type=None) + expected='urn:publicid:IDN++' + self.assertEqual(void.get_hrn(),'') + self.assertEqual(void.get_type(),None) + self.assertEqual(void.get_urn(),expected) + loop=Xrn(xrn=expected) + self.assertEqual(loop.get_hrn(),'') + # xxx - this is not quite right as the first object has type None + self.assertEqual(loop.get_type(),'') def test_host001 (self): @@ -93,15 +105,15 @@ class TestXrn(unittest.TestCase): def test_login_base_001 (self): - xrn=PlXrn(hrn='ple.inria.omftest',type='slice') - self.assertEqual(xrn.login_base(),'inria') + xrn=PlXrn(xrn='ple.inria.omftest',type='slice') + self.assertEqual(xrn.pl_login_base(),'inria') def test_slicename_001 (self): - xrn=PlXrn(hrn='ple.inria.omftest',type='slice') - self.assertEqual(xrn.slicename(),'inria_omftest') + xrn=PlXrn(xrn='ple.inria.omftest',type='slice') + self.assertEqual(xrn.pl_slicename(),'inria_omftest') def test_authname_001 (self): - xrn=PlXrn(hrn='ple.inria.omftest',type='slice') - self.assertEqual(xrn.authname(),'inria') + xrn=PlXrn(xrn='ple.inria.omftest',type='slice') + self.assertEqual(xrn.pl_authname(),'inria')