示例#1
0
    def test_request_must_be_secure(self):
        environ = self.get_wsgi_environ()
        environ['wsgi.url_scheme'] = 'https'
        request = HttpRequest(environ)

        self.assertTrue(request.is_secure(), "Request must be secure")
示例#2
0
    def test_request_must_be_ajax(self):
        environ = self.get_wsgi_environ()
        environ['HTTP_X_REQUESTED_WITH'] = 'XMLHTTPRequest'
        request = HttpRequest(environ)

        self.assertTrue(request.is_ajax(), "Request must be ajax")