def testSimplePath(self):
     f = PathFilter('/path')
     f.addObserver(self.interceptor)
     consume(f.handleRequest(path='/path', otherArgument='value'))
     self.assertEquals(1, len(self.interceptor.calledMethods))
     self.assertEquals('handleRequest', self.interceptor.calledMethods[0].name)
     self.assertEquals({'path':'/path', 'otherArgument':'value'}, self.interceptor.calledMethods[0].kwargs)
 def testExcludingPaths(self):
     f = PathFilter('/path', excluding=['/path/not/this'])
     f.addObserver(self.interceptor)
     consume(f.handleRequest(path='/path/not/this/path'))
     self.assertEquals(0, len(self.interceptor.calledMethods))
     consume(f.handleRequest(path='/path/other'))
     self.assertEquals(1, len(self.interceptor.calledMethods))
 def testExcludingPaths(self):
     f = PathFilter('/path', excluding=['/path/not/this'])
     f.addObserver(self.interceptor)
     consume(f.handleRequest(path='/path/not/this/path'))
     self.assertEqual(0, len(self.interceptor.calledMethods))
     consume(f.handleRequest(path='/path/other'))
     self.assertEqual(1, len(self.interceptor.calledMethods))
 def testSimplePath(self):
     f = PathFilter('/path')
     f.addObserver(self.interceptor)
     consume(f.handleRequest(path='/path', otherArgument='value'))
     self.assertEqual(1, len(self.interceptor.calledMethods))
     self.assertEqual('handleRequest', self.interceptor.calledMethods[0].name)
     self.assertEqual({'path':'/path', 'otherArgument':'value'}, self.interceptor.calledMethods[0].kwargs)
 def testPaths(self):
     f = PathFilter(['/path', '/other/path'])
     f.addObserver(self.interceptor)
     consume(f.handleRequest(path='/other/path'))
     self.assertEquals(1, len(self.interceptor.calledMethods))
 def testPaths(self):
     f = PathFilter(['/path', '/other/path'])
     f.addObserver(self.interceptor)
     consume(f.handleRequest(path='/other/path'))
     self.assertEqual(1, len(self.interceptor.calledMethods))
示例#7
0
 def testOtherPath(self):
     f = PathFilter('/path')
     f.addObserver(self.interceptor)
     consume(f.handleRequest(path='/other/path'))
     self.assertEquals(0, len(self.interceptor.calledMethods))