Ejemplo n.º 1
0
 def testextended(self):
     """
     TODO
     """
     input = "</my/Path>;rt=\"MyName\";if=\"/someRef/path\";ct=42;obs;sz=10"
     root = Resource(link_format=input)
     my = Resource("my")
     my.setResourceType("replacement")
     root.add(my)
     str(root)
     res = root.getResource("/my/Path")
     self.assertNotNull(res)
     res = root.getResource("my/Path")
     self.assertNotNull(res)
     res = root.getResource("my")
     res = res.getResource("Path")
     self.assertNotNull(res)
     res = res.getResource("/my/Path")
     self.assertNotNull(res)
     self.assertEquals("Path", res.__name__)
     self.assertEquals("/my/Path", res.getPath())
     self.assertEquals("MyName", res.getResourceType().get(0))
     self.assertEquals("/someRef/path", res.getInterfaceDescription().get(0))
     self.assertEquals(42, res.getContentTypeCode().get(0).intValue())
     self.assertEquals(10, res.getMaximumSizeEstimate())
     self.assertTrue(res.isObservable())
     res = root.getResource("my")
     self.assertNotNull(res)
     self.assertEquals("replacement", res.getResourceType().get(0))
Ejemplo n.º 2
0
 def conversionTest(self):
     """
     TODO
     """
     link1 = "</myUri/something>;ct=42;if=\"/someRef/path\";obs;rt=\"MyName\";sz=10"
     link2 = "</myUri>;rt=\"NonDefault\""
     link3 = "</a>"
     format = "%s,%s,%s" % (link1, link2, link3)
     res = Resource(format)
     str(res)
     result = res.link()
     print("%s,%s,%s" % (link3, link2, link1))
     print(result)
     self.assertEquals("%s,%s,%s" % (link3, link2, link1), result)