-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Implemented IUserEmailsClient GetAll and Add methods #323
Conversation
Also looks as if this was already implemented in a different pull request. |
@pmacn I really need to go back and revive those PRs that are languishing there, unloved... |
I'll update this to just add the Add method, however the current implementation has it sitting on the |
methods plus unit tests.
Their cries keep me up at night! |
@@ -99,22 +99,4 @@ public class TheUpdateMethod | |||
Assert.Equal(HttpStatusCode.Unauthorized, e.StatusCode); | |||
} | |||
} | |||
|
|||
public class TheGetEmailsMethod |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Plans to bring back this integration test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, there was a reason for this being out and I thought I put a comment in about it. I was obviously mistaken.
What I wanted to do was to try and replace it with something that would pass for everyone. Maybe simply check that it returns an email at all?
I guess another option would just be to have anyone who wants to run these change the email on their test account?
(Not sure if that's doable and it might leave a lot of test accounts with forgotten and un-retrievable passwords? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe simply check that it returns an email at all?
👍 Let's start simple and go from there
not sure how I missed that before :-/
Sorry about the delay haven't been able to get around to it until now. |
/// <summary> | ||
/// Gets all email addresses for the authenticated user. | ||
/// </summary> | ||
/// <returns></returns> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Finish up the returns
elements here and I think this is ready to 🚢
…user_emails_client
and EmailAddress
EmailAddress.DebuggerDisplay
default implementation. Still needs delete method which is skipped because it's a HTTP DELETE. There's currently nothing in the ApiConnection to handle this scenario and it's a rather unorthodox thing to support. delete.
This only tests the GetAll method at this point. Would like to have Delete implemented before testing Add so that we can do cleanup.
I think this has everything in it now. Except for the
|
I'm receiving the following two errors when trying to run build.cmd all of a sudden
and
|
Apparently the above two messages was because I had a custom environmental variable set called MSBUILD that pointed to that directory. Something I had set up for a different build. |
Client and ObservableUserEmailsClient
}; | ||
var client = new ObservableUserEmailsClient(github); | ||
|
||
var email = await client.GetAll(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rx note: when you await
on an observable you're doing the same thing as a .First()
(which is now deprecated in Rx).
The test itself is just checking we get something back, which is fine, but just something to watch for. If you wanted all the results, you could await client.GetAll().ToArray()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which is now deprecated in Rx
Wasn't aware that it's been deprecated. I'll just make the test more Rxish in a separate PR.
But yes, my intention with the test was just to see that we got at least one EmailAddress
back.
Implemented IUserEmailsClient GetAll and Add methods
Did not implement the Delete method as it is a DELETE that sends a request body.
http://developer.github.com/v3/users/emails/#delete-email-addresses
Not unheard of but still rather unorthodox especially since the body identified the resources to delete. So maybe it's time to start a lobbying group for that as well? If it's not something that's likely to change I'll go ahead and add the required infrastructure methods to handle deletes with a body, but would at least want to check first.
cc @pengwynn
Because you seem to be one of the people to call on for all things GitHub API