-
-
Notifications
You must be signed in to change notification settings - Fork 16.8k
Closed
Description
Expected Behavior
The POST request to /login should result in a response with status code 200.
def initialize_authentication(self):
soup = BeautifulSoup(self.client.get(os.environ['URL'] + "login/").data, features="html5lib")
csrf_token = soup.find('input', dict(name='csrf_token'))['value']
self.client.set_cookie(key='csrf_token', value=csrf_token, server_name='localhost')
payload = {
'username': os.environ['username'],
'password': os.environ['password'],
}
headers = {
'X-CSRFToken': csrf_token,
'Accept': 'application/json'
}
response = self.client.post(os.environ['URL'] + "login/", data=payload, headers=headers,
follow_redirects=True)
self.assertEqual(200, response.status_code, "Login Request failed!")
return csrf_tokenActual Behavior
Tell us what happens instead.
Error
Traceback (most recent call last):
File "/usr/lib/python3.5/unittest/case.py", line 58, in testPartExecutor
yield
File "/usr/lib/python3.5/unittest/case.py", line 596, in run
self.setUp()
File "/home/lenovo/Desktop/ML/mv/tests/mv_tests/integration_tests/parent_join_integration_tests.py", line 31, in setUp
self.csrf_token = self.initialize_authentication()
File "/home/lenovo/Desktop/ML/mv/tests/mv_tests/mv_base_tests.py", line 35, in initialize_authentication
_, status_code = self.post(os.environ['URL'] + "login/", data=payload, csrf_token=csrf_token)
File "/home/lenovo/Desktop/ML/mv/tests/mv_tests/mv_base_tests.py", line 58, in post
rv = self.client.post(url, data=data, headers=self.get_headers(csrf_token), follow_redirects=True)
File "/home/lenovo/Desktop/ML/mv/venv/lib/python3.5/site-packages/werkzeug/test.py", line 1038, in post
return self.open(*args, **kw)
File "/home/lenovo/Desktop/ML/mv/venv/lib/python3.5/site-packages/flask/testing.py", line 127, in open
follow_redirects=follow_redirects)
File "/home/lenovo/Desktop/ML/mv/venv/lib/python3.5/site-packages/werkzeug/test.py", line 1016, in open
response, new_location, environ, buffered=buffered
File "/home/lenovo/Desktop/ML/mv/venv/lib/python3.5/site-packages/werkzeug/test.py", line 947, in resolve_redirect
return self.open(builder, as_tuple=True, buffered=buffered)
File "/home/lenovo/Desktop/ML/mv/venv/lib/python3.5/site-packages/flask/testing.py", line 122, in open
builder = make_test_environ_builder(self.application, *args, **kwargs)
File "/home/lenovo/Desktop/ML/mv/venv/lib/python3.5/site-packages/flask/testing.py", line 29, in make_test_environ_builder
url = url_parse(path)
File "/home/lenovo/Desktop/ML/mv/venv/lib/python3.5/site-packages/werkzeug/urls.py", line 457, in url_parse
i = url.find(s(":"))
AttributeError: 'EnvironBuilder' object has no attribute 'find'
Environment
- Python version: 3.5.2
- Flask version: 0.12.2
- Werkzeug version: 0.15.1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels