示例#1
0
 def setup(self):
     environ = sample_environ(HTTP_COOKIE='watson.session=123456;',
                              REQUEST_METHOD='POST')
     environ['wsgi.input'] = BufferedReader(
         BytesIO(b'form_csrf_token=123456&test=blah'))
     self.request = create_request_from_environ(
         environ, 'watson.http.sessions.Memory')
示例#2
0
 def setup(self):
     self.protected_form = has_csrf(UnprotectedForm)
     data = 'test=blah'
     environ = sample_environ(REQUEST_METHOD='POST')
     environ['wsgi.input'] = BufferedReader(BytesIO(data.encode('utf-8')))
     environ['CONTENT_LENGTH'] = len(data)
     self.request = Request.from_environ(
         environ, 'watson.http.sessions.Memory')
示例#3
0
 def setup(self):
     environ = sample_environ(
         HTTP_COOKIE='watson.session=123456;',
         REQUEST_METHOD='POST')
     environ['wsgi.input'] = BufferedReader(
         BytesIO(b'form_csrf_token=123456&test=blah'))
     self.request = create_request_from_environ(
         environ, 'watson.http.sessions.Memory')
示例#4
0
 def setup(self):
     data = 'form_csrf_token=123456&test=blah'
     environ = sample_environ(
         HTTP_COOKIE='watson.session=123456;',
         REQUEST_METHOD='POST',
         CONTENT_LENGTH=len(data))
     environ['wsgi.input'] = BufferedReader(
         BytesIO(data.encode('utf-8')))
     self.request = Request.from_environ(
         environ, 'watson.http.sessions.Memory')
示例#5
0
 def test_multiple_values(self):
     form = MultipleForm('test')
     data = 'checkbox[]=1&checkbox[]=2'
     environ = sample_environ(
         REQUEST_METHOD='POST',
         CONTENT_LENGTH=len(data))
     environ['wsgi.input'] = BufferedReader(
         BytesIO(data.encode('utf-8')))
     request = Request.from_environ(
         environ, 'watson.http.sessions.Memory')
     form.data = request
     assert form.test == ['1', '2']
示例#6
0
 def setup(self):
     self.protected_form = has_csrf(UnprotectedForm)
     environ = sample_environ(REQUEST_METHOD='POST')
     environ['wsgi.input'] = BufferedReader(BytesIO(b'test=blah'))
     self.request = create_request_from_environ(
         environ, 'watson.http.sessions.Memory')
示例#7
0
 def setup(self):
     self.protected_form = has_csrf(UnprotectedForm)
     environ = sample_environ(REQUEST_METHOD='POST')
     environ['wsgi.input'] = BufferedReader(BytesIO(b'test=blah'))
     self.request = create_request_from_environ(environ, 'watson.http.sessions.Memory')