示例#1
0
 def test_dublicates(self):
     r1, r2 = self._mk_ress(2)
     try:
         web.buildResourceTree({"a": {"b": r1}, "a/b": r2})
     except ValueError:
         pass
     else:
         self.fail("expected ValueError")
示例#2
0
 def test_dublicates(self):
     r1, r2 = self._mk_ress(2)
     try:
         web.buildResourceTree({
             'a': {
                 'b': r1
             },
             'a/b': r2,
         })
     except ValueError:
         pass
     else:
         self.fail("expected ValueError")
示例#3
0
 def test_subresourecs(self):
     r1, r2, r3, r4 = self._mk_ress(4)
     r = web.buildResourceTree([("/a/b", r1), ("/a", r2), ("/c/d/", r3), ("", r4)])
     self.assertChild(r1, r, ["a", "b"])
     self.assertChild(r2, r, ["a"])
     self.assertChild(r3, r, ["c", "d", ""])
     self.assertChild(r4, r, [])
示例#4
0
 def test_recurive(self):
     r1, r2 = self._mk_ress(2)
     r = web.buildResourceTree({
         'a': {
             'b': {
                 'c': r1
             }
         },
         'a/b': r2,
     })
     self.assertChild(r1, r, ['a', 'b', 'c'])
     self.assertChild(r2, r, ['a', 'b'])
示例#5
0
 def test_subresourecs(self):
     r1, r2, r3, r4 = self._mk_ress(4)
     r = web.buildResourceTree([
         ("/a/b", r1),
         ("/a", r2),
         ("/c/d/", r3),
         ("", r4),
     ])
     self.assertChild(r1, r, ['a', 'b'])
     self.assertChild(r2, r, ['a'])
     self.assertChild(r3, r, ['c', 'd', ''])
     self.assertChild(r4, r, [])
示例#6
0
 def test_recurive(self):
     r1, r2 = self._mk_ress(2)
     r = web.buildResourceTree({"a": {"b": {"c": r1}}, "a/b": r2})
     self.assertChild(r1, r, ["a", "b", "c"])
     self.assertChild(r2, r, ["a", "b"])
示例#7
0
 def test_asis(self):
     res = TestResource()
     r = web.buildResourceTree(res)
     self.assertIs(res, r)
     self.assertNot(r.children)
示例#8
0
 def test_only_root(self):
     res = web.Resource()
     r = web.buildResourceTree({None: res})
     self.assertIs(res, r)
     self.assertNot(r.children)
示例#9
0
 def test_asis(self):
     res = TestResource()
     r = web.buildResourceTree(res)
     self.assertIs(res, r)
     self.assertNot(r.children)
示例#10
0
 def test_only_root(self):
     res = web.Resource()
     r = web.buildResourceTree({None: res})
     self.assertIs(res, r)
     self.assertNot(r.children)