-
Notifications
You must be signed in to change notification settings - Fork 595
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stubbing out authentication #936
Comments
This should definitely be possible. Can you show me how you're getting the Dataset instance and the errors/signs that it's not working that you are getting? |
I put together a test branch, please give it a shot and let me know how it goes! $ npm install --save stephenplusplus/gcloud-node#spp--gcd-no-auth |
Thanks for the response. I'll give that branch a go tomorrow. So far I've just set the DATASTORE_HOST environment variable to my gcd server as I haven't come across any specific instructions for stubbing out the oAuth call that is made with the credentials. |
I get an invalid_grant response out of the gcloud lib when calling dataset.save |
That's mainly what I was wondering. Our code currently isn't seeing that and turning off the auth step. Hopefully that branch resolves that. |
Looks like this may now be turning off the auth step but breaking something else further down the line as when it comes to doing the save I get I found that |
Oops, good catch. I just pushed a fix (hopefully). If this works, I'll probably re-think how this is written before sending a PR. It's getting a wee bit messy. |
Yep that change seems to have done the trick. These are my thoughts on the tests/implementation (slightly naive perhaps given I don't know any of the rest of the code base), hope they're welcome 😄 ... I thought that with the current implementation the tests would be better just asserting that ds.apiEndpoint is set to the correct URL depending on the options/env, rather than testing the implementation of that private determineApiEndpoint_ function. And if determineApiEndpoint_ became just getCustomEndpoint then you shouldn't need to mutate the options parameter as a side effect. I did feel it also needs a test that when a custom endpoint is provided then it sets up the auth correctly as presumably that's why this slipped through the net. That was the main thing I couldn't work out how to do given the current state of things, so I guess you may want to tweak things further. Anyway. Thanks for your help! Can live with it making the live auth calls for the time being until you figure something out. |
Of course, all thoughts are welcome. I will ping you when it's in the PR On Wednesday, November 11, 2015, Chris Impey [email protected]
|
Good work 👍 When might this make it to npm? |
I'll shoot for Wednesday/Thursday next week. Our code is in a bit of a transition state right now, we have a few more PRs to squeeze in. Will ping you when it's out! |
- [ ] Regenerate this pull request now. Committer: @summer-ji-eng PiperOrigin-RevId: 434859890 Source-Link: googleapis/googleapis@bc2432d Source-Link: googleapis/googleapis-gen@930b673 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOTMwYjY3MzEwM2U5MjUyM2Y4Y2ZlZDM4ZGVjZDdkM2FmYWU4ZWJlNyJ9
I have the gcloud module talking to a local cloud datastore using the gcd tool for automated testing but am finding that it only works if I provide real credentials from my google console. Is there a way to stub out the authentication process so I can use test credentials?
The text was updated successfully, but these errors were encountered: