Ejemplo n.º 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')
Ejemplo n.º 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')
Ejemplo n.º 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')
Ejemplo n.º 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')
Ejemplo n.º 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']
Ejemplo n.º 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')
Ejemplo n.º 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')