I've got a flask app that implements a REST api. For reasons, I'm using HTTP Digest Authentication. I've used the Flask-HTTPAuth library to implement the digest authentication and it works; however, I am unable to authenticate in the unit tests.
For the unit tests, prior to setting up the authentication, I'm doing something like this:
class FooTestCase(unittest.TestCase):
def setUp(self):
self.app = foo.app.test_client()
def test_root(self):
response = self.app.get('/')
# self.assert.... blah blah blah
Prior to implementing the authentication, this was fine. Now I get a 401, which is expected as the initial response for a digest auth request. I've searched and searched and followed a few suggestions related to http basic auth (using parameters data = { #various stuff} and follow_redirects=True) but I've had no success.
Does anyone have a clue how to implement unittests in this case?