B
B
BonBon Slick2020-11-29 21:20:18
PHP
BonBon Slick, 2020-11-29 21:20:18

How to test social auth?

You can use the token just issued by the same google for tests, but it will expire over time and the test will fall.

Perhaps somehow https://github.com/knpuniversity/oauth2-client-bundle will help in the tests? For example, are there test stubs for the google auth API?
Or create 1 prod and 1 more test API account for Google, check env on the server.
If prod calls the real Google API for authorization, if test === env then pull the stub, but it must return real data so that the user can be registered. Of course, you can just fake a user right away, but then it’s already testing the registration and login of a fake user, and not a real API call with everyone coming out. For example, the google API can change the structure of the response, and then we will not notice this in the test when the user is fake.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question