-
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
Add overloads to specify branch for ContentRequest #1093
Conversation
@@ -91,6 +116,18 @@ public CreateFileRequest(string message, string content) : base(message) | |||
} | |||
|
|||
/// <summary> | |||
/// Initializes a new instance of the <see cref="DeleteFileRequest"/> class. |
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.
Typo in the xml doc with the cref to the class name
Hey @M-Zuber I noticed one typo of a class name in XmlDoc comments, ive flagged above. Also could I suggest ensuring we keep the tests up to date with at least these 2 items?
Let me know if you want some help adding the tests |
Thank you for catching the typo! Would you test anything in the unit tests other then that the correct url was called? The integration test can create, update, and then delete a file on the same branch. Sounds good to you? |
Yeah if you look at the "crud" integration test I'd probably do the same actions as that, but specifying a named branch For unit test since the url is the same anyway, you could check that the CreateFileRequest object passed through, has the correct path/message/content/branch present in it. Eg have look at |
I wasn't able to get the unit tests to work, hopefully the integration test will be enough |
Hey @M-Zuber that looks good... your integration test is passing for me here. On the topic of unit tests, your change was mostly to a Request object and it doesnt look like there are many unit tests of those things in octokit.net. However if you are interested, I did just send you a pull request that implements unit tests on the CreateFile() DeleteFile() and UpdateFile() calls in RepositoryClient, including making sure your new branch field is correctly passed through to the underlying ApiClient. What ive found with Octokit unit tests for API clients typically check
|
new DeleteFileRequest("Deleted file", fileSha, branchName)); | ||
|
||
await Assert.ThrowsAsync<NotFoundException>( | ||
async () => await fixture.GetAllContents(repository.Owner.Login, repository.Name, "somefile.txt")); |
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.
I don't think this state machine is necessary. Assert.ThrowsAsync
expects a Task
, which GetAllContents
already 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.
Copy paste error 😄
Will fix when I'm back by a machine.
It is needed. If removed the test completes, but fails with a message that no error was thrown.
EDIT: Drunk VS had me today/
@ryangribble thank you for the PR. I asked a question there. |
Add unit tests for CreateFile DeleteFile and UpdateFile
@ryangribble when do you think this will be merged? |
I don't have commit rights, am sitting on a few pending PR's myself 😀 |
@Thwaitesy @ryangribble apologies for the delay, I'm aiming to get through these by the end of the week. Thankfully we just did a big release, so the next one should be a bit easier to manage... |
Add overloads to specify branch for ContentRequest
YAY!! I got a Stevie!! 😀 |
Fixes #958