go-watson-sdk
go-watson-sdk copied to clipboard
Allow use with Alchemy API, test hygiene
This PR allows the use of go-watson-sdk
with the AlchemyAPI, which can be authenticated against using only an API Key. Previously, such a client configuration would be rejected because a username and password was not present.
This patch adds tests for the existing client behaviour, as well as extending the validation to allow just an API key.
This patch also fixes a small bug with the existing tests, which would set the VCAP_SERVICES
environment variable and never unset it, causing other tests (in the case, the ones added to test API key behaviour!) to fail unexpectedly.
Actually - don't merge this yet, there are a number of failures in CI that look like they might have been caused by the change to the environment variable behaviour. I'll comment again (and add commits) when it's ready to go.
OK - it looks like the tests are already failing on CI on master. I don't think this makes the situation any worse. If I get time, I'll try to see if I can make CI tests pass as well (though that might be difficult if they're actually accessing real services).
So if you're happy with this change @liviosoares then it's good to go.