How to read from standard input during unit tests

Is this something you're doing to test specifically your authentication functionality, or is it a precondition to all other tests?

I'm doing it for both of those reasons. Going through the authorization process is a precondition for 95% of the tests. It's required in order to generate an access token, which is then used in most of the other tests. You can read about the authorization process for the Spotify web API here. I also need to test the authentication functionality. In particular I need to ensure that providing invalid values causes the authentication attempt to be rejected. The results of these tests have important implications for the security of my library.

Are there any kinds of test accounts you can make, whose authorizations could be stored in a secrets file?

I could go through the authorization process a single time before I run the tests and then inject the access token into the program at compile-time, but I actually need to go through the authorization process multiple times. For this reason, it would be extremely inconvenient to have to inject the access token into the program multiple times. I would basically have to re-run the tests each time, which essentially means that they would require more manual input, which is what I'm trying to minimize in the first place.