jeudi 10 novembre 2016

Testing with middlewares enabled

I am working on testing my API endpoints. The api middleware is grouped as following:

'api' => [
    'throttles:1,60',
    'bindings',
    'auth:api'
];

I have the JWT cookie token submitting correctly from my front-end when accessing the API endpoints; that all works fine. But how do I validate the OAuth token when I'm sending requests from my test classes?

I've tried using the 5.2 and below method of $this->actingAs($user) but that doesn't buy me the correct level of auth.

I've tried just using the WithoutMiddleware trait, but that in turn disabled my route model binding. Is the best way really just to comment out the auth:api line during testing?

Aucun commentaire:

Enregistrer un commentaire