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

Search/Users Api #289

Merged
merged 29 commits into from
Feb 10, 2014
Merged

Search/Users Api #289

merged 29 commits into from
Feb 10, 2014

Conversation

hahmed
Copy link
Contributor

@hahmed hahmed commented Dec 31, 2013

#276

@hahmed
Copy link
Contributor Author

hahmed commented Jan 1, 2014

@shiftkey ready for review 😄

var request = new SearchUsersRequest("github");
request.AccountType = AccountType.User;
client.SearchUsers(request);
connection.Received().GetAll<Repository>(Arg.Is<Uri>(u => u.ToString() == "search/users"), Arg.Any<Dictionary<string, string>>());
Copy link
Member

Choose a reason for hiding this comment

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

These tests are failing because the .GetAll<Repository> should be .GetAll<User>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My bad - that's been fixed now.

@shiftkey
Copy link
Member

shiftkey commented Jan 6, 2014

@hahmed one of the things I'd like to challenge you on is how those unit tests actually validate the parameters you set in the query.

So we have a test like this:

[Fact]
public void TestingTheInQualifier()
{
    var connection = Substitute.For<IApiConnection>();
    var client = new SearchClient(connection);
    //get users where the fullname contains 'github'
    var request = new SearchUsersRequest("github");
    request.In = new[] { UserInQualifier.Fullname };
    client.SearchUsers(request);
    connection.Received().GetAll<User>(Arg.Is<Uri>(u => u.ToString() == "search/users"), Arg.Any<Dictionary<string, string>>());
}

We know that the q value on the querystring parameter should contain something, so why not check it within the test, like this?

connection.Received().GetAll<User>(
    Arg.Is<Uri>(u => u.ToString() == "search/users"),
    Arg.Is<Dictionary<string, string>>(d => d["q"] == "???"));

cc @alfhenrik as this is relevant to #290

@hnrkndrssn
Copy link
Contributor

👍

@hahmed
Copy link
Contributor Author

hahmed commented Jan 7, 2014

When i get a moment tomorrow i will look at this. I agree the qualifiers should be tested a bit better.

@hahmed
Copy link
Contributor Author

hahmed commented Jan 8, 2014

We know that the q value on the querystring parameter should contain something, so why not check it within the test, like this?

@shiftkey I agree - I will implement this as per your suggestion.

connection.Received().GetAll<User>(Arg.Is<Uri>(u => u.ToString() == "search/users"), Arg.Any<Dictionary<string, string>>());
connection.Received().GetAll<User>(Arg.Is<Uri>(u => u.ToString() == "search/users"),
Arg.Is<Dictionary<string, string>>(d =>
d["q"] == "something_random"
Copy link
Member

Choose a reason for hiding this comment

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

This should be "something"

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 thanks, nearly ready for review now, just updated all tests. I am rebasing now too.

@hahmed
Copy link
Contributor Author

hahmed commented Jan 25, 2014

@shiftkey ready for review.

{
public SearchUsersRequest(string term)
:base(term)
Copy link
Member

Choose a reason for hiding this comment

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

A 💄 change - bring this back up to the previous line and let the : breathe with some whitespace

@shiftkey
Copy link
Member

There's a few failing tests here because the enum types, such as Language and AccountType, that don't specify the parameter values necessary to map them to the lower-case values...

@hahmed
Copy link
Contributor Author

hahmed commented Jan 31, 2014

@shiftkey thank's will fix them, to be honest I cannot see any failing tests (I mentioned this last time), everything just keeps on passing for some reason, I need to look into why I cannot see any failing tests, something must be broken with my scripts (I never made any updates to that at all).

@shiftkey
Copy link
Member

shiftkey commented Feb 1, 2014

@hahmed if you're running .\build you might have hit this issue #353

Alternatively, you can run .\script\cibuild.ps1 which is the same script the build server runs (takes a bit longer)

@hahmed
Copy link
Contributor Author

hahmed commented Feb 1, 2014

@shiftkey now that I have merged into master, I can run .\build,cmd and I can see 11 failing tests - oh my 😄

@hahmed
Copy link
Contributor Author

hahmed commented Feb 8, 2014

@shiftkey that's all done now. All tests are passing, anything else I missed, please let me know.

@shiftkey
Copy link
Member

slam-dunk

Thanks!

shiftkey added a commit that referenced this pull request Feb 10, 2014
@shiftkey shiftkey merged commit 63083a1 into octokit:master Feb 10, 2014
@hahmed
Copy link
Contributor Author

hahmed commented Feb 10, 2014

Lol... amazing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants