def test_handle_auth(self):
        api = restplus.Api(self.app, serve_challenge_on_401=True)

        with self.app.test_request_context("/foo"):
            resp = api.handle_error(Unauthorized())
            self.assertEqual(resp.status_code, 401)
            expected_data = dumps({'message': Unauthorized.description}) + "\n"
            self.assertEqual(resp.data.decode(), expected_data)

            self.assertTrue('WWW-Authenticate' in resp.headers)
dataset/ETHPy150Open noirbizarre/flask-restplus/tests/legacy/test_api.py/APITestCase.test_handle_auth/original