コード例 #1
0
ファイル: test_http.py プロジェクト: sofian86/Mailman-1
 def test_found_headers(self):
     r = http.found("/", [("Set-Cookie", "name=value")])
     # Pass through WebTest for lint-like checks
     webtest.TestApp(app.RestishApp(r)).get("/")
     # Test response details.
     assert r.headers["Location"] == "/"
     assert r.headers["Set-Cookie"] == "name=value"
コード例 #2
0
ファイル: test_http.py プロジェクト: ish/restish
 def test_found_headers(self):
     r = http.found('/', [('Set-Cookie', 'name=value')])
     # Pass through WebTest for lint-like checks
     webtest.TestApp(app.RestishApp(r)).get('/')
     # Test response details.
     assert r.headers['Location'] == '/'
     assert r.headers['Set-Cookie'] == 'name=value'
コード例 #3
0
ファイル: test_http.py プロジェクト: bloodearnest/restish
 def test_found_headers(self):
     r = http.found('/', [('Set-Cookie', 'name=value')])
     # Pass through WebTest for lint-like checks
     webtest.TestApp(app.RestishApp(r)).get('/')
     # Test response details.
     assert r.headers['Location'] == '/'
     assert r.headers['Set-Cookie'] == 'name=value'
コード例 #4
0
ファイル: test_http.py プロジェクト: sofian86/Mailman-1
 def test_found(self):
     location = "http://localhost/abc?a=1&b=2"
     r = http.found(location)
     # Pass through WebTest for lint-like checks
     webtest.TestApp(app.RestishApp(r)).get("/")
     # Test response details.
     assert r.status.startswith("302")
     assert r.headers["Location"] == location
     assert r.headers["Content-Length"]
     assert "302 Found" in r.body
     assert cgi.escape(location) in r.body
コード例 #5
0
ファイル: test_http.py プロジェクト: ish/restish
 def test_found(self):
     location = 'http://localhost/abc?a=1&b=2'
     r = http.found(location)
     # Pass through WebTest for lint-like checks
     webtest.TestApp(app.RestishApp(r)).get('/')
     # Test response details.
     assert r.status.startswith('302')
     assert r.headers['Location'] == location
     assert r.headers['Content-Length']
     assert '302 Found' in r.body
     assert cgi.escape(location) in r.body
コード例 #6
0
ファイル: test_http.py プロジェクト: greut/restish
 def test_found_unicode(self):
     location = u'http://☃.net/'
     r = http.found(location)
     # Pass through WebTest for lint-like checks
     webtest.TestApp(app.RestishApp(r)).get('/')
     # Test response details.
     assert r.status.startswith('302')
     assert r.headers['Location'] == 'http://xn--n3h.net/'
     assert r.headers['Content-Length']
     assert cgi.escape(location.encode("utf-8")) in r.body
     assert cgi.escape(url.URL(location)) in r.body
コード例 #7
0
ファイル: test_http.py プロジェクト: bloodearnest/restish
 def test_found(self):
     location = 'http://localhost/abc?a=1&b=2'
     r = http.found(location)
     # Pass through WebTest for lint-like checks
     webtest.TestApp(app.RestishApp(r)).get('/')
     # Test response details.
     assert r.status.startswith('302')
     assert r.headers['Location'] == location
     assert r.headers['Content-Length']
     assert '302 Found' in r.body
     assert cgi.escape(location) in r.body
コード例 #8
0
ファイル: resource.py プロジェクト: greut/restish
        def decorator(func):
            # you cannot alter a variable that sits outside the scope
            # so they are renamed
            if to is None:
                dest = fro
                orig = func.__name__
            else:
                dest = to
                orig = fro

            if type(dest) not in (list, tuple):
                dest = dest,
            
            # ignore original func
            new_func = lambda self, request, segments: http.found(request.application_url.child(*dest))
            setattr(new_func, _RESTISH_CHILD, TemplateChildMatcher(orig))
            return new_func
コード例 #9
0
ファイル: test_templating.py プロジェクト: greut/restish
 def html(self, request):
     return http.found("page")
コード例 #10
0
ファイル: test_templating.py プロジェクト: greut/restish
 def element(self, request):
     return http.found("element")
コード例 #11
0
ファイル: resource.py プロジェクト: greut/restish
 def func(self, request, segments, **kwargs):
     return http.found(request.application_url + to._url_for(kwargs))
コード例 #12
0
ファイル: test_http.py プロジェクト: psr/restish
 def test_found(self):
     location = 'http://localhost/abc'
     r = http.found(location)
     assert r.status.startswith('302')
     assert r.headers['Location'] == location