Pytest Flask, error 308 Permanent Redirect when login Pytest Flask, error 308 Permanent Redirect when login flask flask

Pytest Flask, error 308 Permanent Redirect when login


Had the same problem I solved it by adding a Slash /

try this code:

def login(client):return client.post("http://127.0.0.1:8080/login/", data=dict(    username="admin",    password="secret"))

as you can see add the Slash in the login/ like that. it sounds stupid I know but give it a try and let me know.


I got this same error as a result of having two slashes in my path. It was something like:

def test_my_annoying_failing_test(client):   response = client.post('/api//my_path/to-somewhere') # notice the double slash   # ...test continues here..

Changing that double slash to a single slash fixed it for me:

def test_my_annoying_failing_test(client):   response = client.post('/api/my_path/to-somewhere')   # ...test continues here..

I am not sure what the root cause of that issue is though.