Skip to content
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

Merged
merged 8 commits into from
Apr 5, 2016

Conversation

prayankmathur
Copy link
Contributor

@shiftkey
I have added the unit and integration tests for issue #896 . however the build is not running successfully.

@prayankmathur
Copy link
Contributor Author

@shiftkey

The build passed the checks here i guess.
Take a look at the unit and integration tests.

@ryangribble
Copy link
Contributor

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?
You certainly want to link to the issue #896 but also would be good to say a few words here about it so everyone doesnt have to click through to the issue to see what this PR is about.

eg something like this:

Title:

Implement Lock/Unlock functionality for Issues

Description:

This PR implements the locking and unlocking funcitonality for Issues
Fixes #896
Also includes Unit and Integration Tests

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

@prayankmathur prayankmathur changed the title Issue896 Implement Lock/Unlock Functionality for Issues Mar 14, 2016
@prayankmathur
Copy link
Contributor Author

@ryangribble

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).
If you could take the trouble of going through the other PR first, then it could solve the issue.

@prayankmathur prayankmathur changed the title Implement Lock/Unlock Functionality for Issues Implemented Lock/Unlock Functionality for Issues Mar 14, 2016
@prayankmathur
Copy link
Contributor Author

@ryangribble
@shiftkey
I found that this function was not correct.
So corrected that too in the same PR.
Hope that it is fine.

@shiftkey
Copy link
Member

@prayankmathur given it's not related to this feature, a separate PR would be nice for a couple of reasons:

  • we can review it separate to this
  • given it's a simpler change, it's likely to get merged in quicker

I'll leave it up to you whether you'd like to extract that to a new branch.

@prayankmathur
Copy link
Contributor Author

@shiftkey
I ll open a separate PR.

@ryangribble
Copy link
Contributor

Just noting for reference that the status of this PR is

@prayankmathur
Copy link
Contributor Author

@ryangribble
I was waiting for #1140 to be merged.
But now i have opened a separate PR for the UpdateMethod function correction.

@shiftkey
Copy link
Member

@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));
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shiftkey
Why is this function showing changes.
I had opened a seperate PR to change it which has been merged.
The function has changed also here

Had to remove it to remove conflicts.

@prayankmathur
Copy link
Contributor Author

@shiftkey
I have made the necessary changes. Please take a look.

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);
Copy link
Member

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.

@prayankmathur
Copy link
Contributor Author

@shiftkey @ryangribble
Should i rename the reactive function also ?
Because then it's usage would be like

client.Lock(owner, name, 1);

Currently its like

client.LockIssue(owner, name, 1)

@ryangribble
Copy link
Contributor

Yes you should rename it too. In integration or unit tests, you are directly referencing the IObserableIssuesClient which might be what is throwing you off here...

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);

@prayankmathur
Copy link
Contributor Author

@ryangribble
Yeah, forgot that 😁
will make the changes.

@ryangribble
Copy link
Contributor

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
Copy link
Contributor

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"

@ryangribble
Copy link
Contributor

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)

@prayankmathur
Copy link
Contributor Author

@ryangribble
The changes are made successfully. You can now finally take a look. 😀

----EDIT----
travis CI failed because of a system failure

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);
Copy link
Member

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?

@shiftkey
Copy link
Member

@prayankmathur this is getting closer - just added some things that I found while trying to get the tests to run...

@ryangribble
Copy link
Contributor

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 Task<bool> to indicate success

@prayankmathur
Copy link
Contributor Author

@ryangribble
@shiftkey
Right now, I will try to implement the

Delete(Uri uri, object data, string accepts)

And then later on we can open up a new PR.
Is that Fine ?

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
Task<bool>

@prayankmathur
Copy link
Contributor Author

@shiftkey
@ryangribble
Just a gentle reminder to go see the changes that i made in this PR.

@ryangribble
Copy link
Contributor

Also should I implement the Lock/Unlock methods as suggested by @ryangribble which would return
Task

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 Task<bool> accordingly. Link to existing example: OrganizationMembers.Publicize()

/// <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)
Copy link
Contributor

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

Copy link
Member

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...

@ryangribble ryangribble mentioned this pull request Apr 4, 2016
12 tasks
@shiftkey
Copy link
Member

shiftkey commented Apr 5, 2016

I'm happy with the integration test now passing, and the minor stuff remaining can be sorted out later.

Thanks @prayankmathur!

@shiftkey shiftkey merged commit e8df990 into octokit:master Apr 5, 2016
@prayankmathur prayankmathur deleted the issue896 branch April 6, 2016 05:14
@prayankmathur
Copy link
Contributor Author

@shiftkey
👍

@nickfloyd nickfloyd added Type: Feature New feature or request and removed category: feature labels Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants