-
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 Lock/Unlock Functionality for Issues #1185
Conversation
The build passed the checks here i guess. |
Hi @prayankmathur , could I suggest that you reword the pull request title and description to contain a little bit more details about what it's about? eg something like this: Title:
Description:
Also from a quick look, this pull request includes your changes for ther other PR about ItemState/ItemStateFilter etc, which makes it hard to review the diffs in isolation. Ideally you would either do the work on separate branches, or once one PR gets merged, you can merge master into your branch and we will then see the "true" differences in this PR |
Changed the title. Sorry for the trouble. Actually i did branch out this issue, but it turned out that i branched it from my master branch which consisted of the previous bug(which i hadn't branched). |
@ryangribble |
@prayankmathur given it's not related to this feature, a separate PR would be nice for a couple of reasons:
I'll leave it up to you whether you'd like to extract that to a new branch. |
@shiftkey |
Just noting for reference that the status of this PR is
|
@ryangribble |
@prayankmathur this looks like it contains work from #1140 (open) and #1196 (merged). Are you able to rebase the branch so that this only contains the work related to the locking and unlocking of issues? |
Assert.Throws<ArgumentNullException>(() => client.Update("owner", null, 42, new IssueUpdate())); | ||
Assert.Throws<ArgumentException>(() => client.Update("owner", "", 42, new IssueUpdate())); | ||
Assert.Throws<ArgumentNullException>(() => client.Update("owner", "name", 42, null)); | ||
} |
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.
@shiftkey |
var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue); | ||
var retrieved = await _issuesClient.Get(_context.RepositoryOwner, _context.RepositoryName, issue.Number); | ||
|
||
Assert.Equal(false, issue.Locked); |
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.
You can use Assert.False
or Assert.True
here to make these a bit more succinct.
@shiftkey @ryangribble
Currently its like
|
Yes you should rename it too. In integration or unit tests, you are directly referencing the Remember that "regular" users of octokit will be accessing both the standard or observable clients, through the "proper" heierarchy eg var client = new ObservableGitHubClient( ... );
await client.Issue.Lock(owner, name, 1); |
@ryangribble |
Also dont forget you've got merge conflicts so either merge master into your branch, or rebase your branch on master and force push |
@@ -337,6 +337,56 @@ public void EnsuresArgumentsNotNull() | |||
} | |||
} | |||
|
|||
public class TheLockIssueMethod |
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 guess this now should be "TheLockMethod"
Looks like you're ontop of the test failures which is 👍 Ive highlighted a couple of REALLY minor consistency issues around naming unit tests (now the methods have been renamed) |
@ryangribble ----EDIT---- |
await _issuesClient.Lock(_context.RepositoryOwner, _context.RepositoryName, issue.Number); | ||
retrieved = await _issuesClient.Get(_context.RepositoryOwner, _context.RepositoryName, issue.Number); | ||
Assert.NotNull(retrieved); | ||
Assert.True(issue.Locked); |
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.
We should be checking retrieved.Locked
here, right?
@prayankmathur this is getting closer - just added some things that I found while trying to get the tests to run... |
Regarding the actual implementation of Lock and Unlock methods (which are API PUT methods that return a 204 response on success) I suggest we should implement them similarly to OrganizationMembers.Publicize() In other words, check for that 204 response and return a |
@ryangribble
And then later on we can open up a new PR. And please review the implementation of the Delete method. I was somewhat confused on how to do that. Also should I implement the Lock/Unlock methods as suggested by @ryangribble which would return |
…nd changed definition for Unlock accordingly
@shiftkey |
Yes please 😀 @shiftkey also gave this a 👍 so we are in agreement that when the API docs mention a 204 response as success... you can check for that and return |
/// <param name="data">The object to serialize as the body of the request</param> | ||
/// <param name="accepts">Specifies accept response media type</param> | ||
/// <returns>The returned <seealso cref="HttpStatusCode"/></returns> | ||
public async Task<HttpStatusCode> Delete(Uri uri,object data, string accepts) |
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.
missing space in between uri and object
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.
This will be handled by the next FormatCode
call, so let's 👢 addressing this...
I'm happy with the integration test now passing, and the minor stuff remaining can be sorted out later. Thanks @prayankmathur! |
@shiftkey
I have added the unit and integration tests for issue #896 . however the build is not running successfully.