lundi 11 décembre 2017

How to test redirections in Bottle.py?

I wanted to test redirection in my Bottle application. Unfortunately I did not find the way to test the redirection location. So far I was just able to test that the redirection was held, by testing that BottleException was raised.

def test_authorize_without_token(mocked_database_utils):
  with pytest.raises(BottleException) as resp:
    auth_utils.authorize()

Is there a way to obtain HTTP response status code or/and redirection location?

Thanks for help.

Aucun commentaire:

Enregistrer un commentaire