I am writing a REST API for authentication, which return a token if the endpoint /user/login is called with mail and password inside the body. I can cover all the code, where an error occus, for example the password or mail is missing inside the body, or the mail does not exist in the database. Can i test this endpoint for successful authentication without relying on the corrosponding POST Endpoint to correctly registering a user inside the database.
In my case I have an endpoint /user/register, which takes mail, name, password and creates a user inside the database.
Is there a way to test these two dependent endpoints independently?
Edit: Only way I could think of is posting the user in the before call and then test for it and seperately test the post endpoint