def test_vh_noPlusPlus(self): from zope.app.traversing.namespace import vh # GET /folder1/folder2/++vh++http:host:80/folder1_1 request = TestRequest(['folder1', 'folder2'], ['folder1_1']) ob = object() handler = vh(ob, request) self.assertRaises(ValueError, handler.traverse, 'http:host:80', ())
def test_vh_host(self): from zope.app.traversing.namespace import vh request = TestRequest(['folder1'], ['folder1_1', '++']) ob = object() result = vh(ob, request).traverse('http:www.fubarco.com:80', ()) self.assertEqual(request._app_server, 'http://www.fubarco.com:80')
def test_vh(self): from zope.app.traversing.namespace import vh # GET /folder1/++vh++/x/y/z/++/folder1_1 request = TestRequest(['folder1'], ['folder1_1', '++', 'z', 'y', 'x']) ob = object() result = vh(ob, request).traverse('', ()) self.assertEqual(result, ob) self.assertEqual(request._traversal_stack, ['folder1_1']) self.assertEqual(request._traversed_names, []) self.assertEqual(request._app_names, ['x', 'y', 'z']) self.assertEqual(request._app_server, 'http://server')