To test this, I decided to look into the .gitconfig used for the test and
examine the credential helpers. However, the format of the git command is
`git config --get credential.<URL>.helper`
What's awkward about this is that the <URL> depends on the host the user
specified when running the tests, meaning I'd need to create a key like
credential.https://github.com.helper to access what I need while setting
this up.
There was no functionality for string formatting before, so I added the
command formattedStringToEnv which essentially wraps fmt.Sprintf() and
saves the string to an environment variable.
This allowed me to dynamically create the config key in the test.
The previous commit introduced two new functions, setEnvVar and
deleteEnvVar that are duplicative of functionality native to testscripts.
This commit switches to the native functionality and removes the
duplicative functions introduced in the previous commit.
Additionally, it removes the `--token` flag that was added to
`gh auth login`
Additionally, this commit adds acceptance testing for `gh auth login` and
`gh auth logout`.
The --token flag was necessary for adding testing for `gh auth login`
because the current implementation with `--with-token` appears to be
broken. It hangs, waiting for user input, but user input doesn't exit it.
Additionally, it appears that `--with-token` is intended to allow for TTY
input of an auth token, but it isn't implemented.
`--with-token` does work when used with the redirect operator `<` when the
token is saved in a file. However, due to limitations of testscripts, I
could not use a file for saving the token in a repeatable manner. Thus,
implementing the `--token` flag seemed like a quick solution to validate
that the direction I was going during testing was valid.
Whether the flag stays or not is up for discussion, and I'd love to get
input on that from the team.