mercredi 5 juillet 2017

How to stub (to bypass) a Sailsjs auth policy to allow for controller testing?

I have a Sailsjs controller that does some stuff, but currently it is under a policy that requires authentication (i.e. isAuthenticated).

Before having applied that policy, the integration test for my controller worked fine. Now it will not work because it requires the user to login.

For reasons not stated, I cannot make a request to login before each test, so I have to find a way to skip that policy. I would like to stub it so it always lets the route go through. How would you do that in Sailsjs v0.12.11?

Aucun commentaire:

Enregistrer un commentaire