def test_restful_ignore_extension(self): env = {'request_method': 'GET', 'PATH_INFO': '/welcome/default/index/127.0.0.1'} r = Request(env) regex_url_in(r, env) @r.restful(ignore_extension=True) def ignore_rest(): def GET(*args, **vars): return args[0] return locals() self.assertEqual(ignore_rest(), '127.0.0.1')
def test_restful_calls_post(self): env = {'request_method': 'POST', 'PATH_INFO': '/welcome/default/index'} r = Request(env) regex_url_in(r, env) @r.restful() def post_rest(): def POST(*args, **vars): return 'I posted' return locals() self.assertEqual(post_rest(), 'I posted')
def test_restful_simple(self): env = {'request_method': 'GET', 'PATH_INFO': '/welcome/default/index/1.pdf'} r = Request(env) regex_url_in(r, env) @r.restful() def simple_rest(): def GET(*args, **vars): return args[0] return locals() self.assertEqual(simple_rest(), '1')
def test_restful_ignore_extension(self): env = {'request_method': 'GET', 'PATH_INFO': '/welcome/default/index/127.0.0.1'} r = Request(env) regex_url_in(r, env) @r.restful(ignore_extension=True) def ignore_rest(): def GET(*args, **vars): return args[0] return locals() self.assertEqual(ignore_rest(), '127.0.0.1')
def test_restful_calls_post(self): env = {'request_method': 'POST', 'PATH_INFO': '/welcome/default/index'} r = Request(env) regex_url_in(r, env) @r.restful() def post_rest(): def POST(*args, **vars): return 'I posted' return locals() self.assertEqual(post_rest(), 'I posted')
def test_restful_simple(self): env = {'request_method': 'GET', 'PATH_INFO': '/welcome/default/index/1.pdf'} r = Request(env) regex_url_in(r, env) @r.restful() def simple_rest(): def GET(*args, **vars): return args[0] return locals() self.assertEqual(simple_rest(), '1')