Reputation: 7465
I've been trying to run unittests in Python/Flask, but many of the pages on my site involve an authenticated user. In Django, it's really easy to authenticate a user in the backend (see here: https://docs.djangoproject.com/en/1.3/topics/testing/#testing-tools). Is there something similar that I can use in Flask? I'm currently running the Flask Auth (http://pythonhosted.org/Flask-Auth/) authentication system, but I am willing to switch if there is a way to easily test my authenticated pages with another Flask authentication library.
Thanks!
Upvotes: 2
Views: 877
Reputation: 7822
Have you tried Flask integrated unit testing tools?
You can make post requests with them, so that you can log in log out and act as authenticated users. I don't know if that is sufficient for you, perhaps you need some more advanced stuff, but you can give it a try.
Upvotes: 1