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

Added ApiOption overloads to methods on IRepositoryPagesClient and IObservableRepositoryPagesClient #1213

Closed
wants to merge 18 commits into from

Conversation

prayankmathur
Copy link
Contributor

@shiftkey
@ryangribble

Refer #1178

Added the methods as well as tests (reactive methods too).

Ensure.ArgumentNotNull(options, "options");

var endpoint = ApiUrls.RepositoryPageBuilds(owner, repositoryName);
return ApiConnection.GetAll<PagesBuild>(endpoint, null, AcceptHeaders.StableVersion, options);
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 able to get away with just using the GetAll<T> overload that takes endpoint and options, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, my bad 😁
Have made the changes

@prayankmathur
Copy link
Contributor Author

@shiftkey
Made the changes. Take a look.

@shiftkey
Copy link
Member

@prayankmathur looks like some tests need to be updated

@prayankmathur
Copy link
Contributor Author

@shiftkey
Yeah, I was doing that.
Also, shouldn't there be a change here too, like the one that you suggested.

@shiftkey
Copy link
Member

@prayankmathur you're right - I'll correct that and open a separate PR for it...

@@ -31,7 +31,7 @@ public void RequestsCorrectUrl()
}
}

public class TheGetBuildsMethod
public class TheGetAllBuildsMethod
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 TheGetAllMethod

@shiftkey
Copy link
Member

@prayankmathur this is looking good.

We don't seem to have any integration tests for the RepositoryPagesClient, but that seems to be covered by the ObservableRepositoryPagesClientTests tests. Would you mind adding that in now, at least just for the new GetAll methods we're adding here?

@prayankmathur
Copy link
Contributor Author

@shiftkey
I have added the integration tests as you said. Please take a look.

/// <param name="owner">The owner of the repository</param>
/// <param name="repositoryName">The name of the repository</param>
/// <param name="options">Options for changing the behaviour of the API</param>
/// <remarks>
Copy link
Contributor

Choose a reason for hiding this comment

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

extraneous whitespace here? 2 spaces in ///..<remarks> instead of 1.
Seems to be the case on a few of the xmldoc sections in multiple files in this PR

Also should the description of <param name="options"> be the same between observable and regular client concrete and interfaces? Currently across the 4 places, there are 3 different wordings

Options for changing the behaviour of the API

Options to change the behaviour of the API

Options to change the API response

@prayankmathur
Copy link
Contributor Author

@ryangribble
I changed the description to

Options to change the API response

And i guess it should be same.

/// <param name="owner">The owner of the repository</param>
/// <param name="repositoryName">The name of the repository</param>
/// <param name="options">Options to change the API response</param>
/// <remarks>
Copy link
Contributor

Choose a reason for hiding this comment

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

whitespace

@prayankmathur
Copy link
Contributor Author

@ryangribble
I have removed the whitespaces. Actually I copy pasted the description from the function above and therefore the whitespace crept in everywhere.

Please take a look.

@ryangribble
Copy link
Contributor

Looks good now. Yeah I realise often these little inconsistencies are already in the files, but whenever we are touching files I like to clean whatever we can up as we go 👍

@prayankmathur
Copy link
Contributor Author

@ryangribble
@shiftkey
Why are there no integration tests for the methods in the RespositoryPagesClient ?
I have added the tests for the GetAll
what about the remaining methods.

@devkhan
Copy link
Contributor

devkhan commented Mar 30, 2016

@prayankmathur There is some code at places which is not covered by tests. I have encountered this situation in the TeamsClient also, so I think we should add tests wherever they are missing.

@shiftkey
Copy link
Member

shiftkey commented Apr 4, 2016

@prayankmathur

Why are there no integration tests for the methods in the RespositoryPagesClient?

Probably something that was missed at the time. Given this is a read-only interface it should be easy to use the Octokit.NET repository (or something similar) and craft some simple tests to get our coverage up...

@prayankmathur
Copy link
Contributor Author

@shiftkey
So should i do the honors and include them too ? 😀

@ryangribble
Copy link
Contributor

You know the answer's gonna be yes 😀 We always like moar tests

image

@shiftkey
Copy link
Member

shiftkey commented Apr 6, 2016

So should i do the honors and include them too ?

@prayankmathur
Copy link
Contributor Author

@shiftkey
@ryangribble
I have added some tests for the functions.
Please take a look.
Also is there a way to check GetLatest returns the latest build, because i couldn't find a way.

await Assert.ThrowsAsync<ArgumentNullException>(() => client.Get("owner", null));
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAll(null, "name", new ApiOptions()));
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAll("owner", null, new ApiOptions()));
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAll("owner", "name", null));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you also add a EnsuresNonEmptyArguments() test function that passes "" into the variuos parameters and ensures exceptions are thrown?

@ryangribble
Copy link
Contributor

Ive made a couple of minor comments. Also it seems like there are no unit tests for Observable client.

Also is there a way to check GetLatest returns the latest build, because i couldn't find a way.

Im not too familiar with the Pages side of things, I'll have a look but it could be as you say, no way to know if it's truly the latest or not. As long as you are calling the right endpoint etc (as verified by unit tests) you have to trust the github api will return latest when we ask for it 😀

@shiftkey
Copy link
Member

@ryangribble @prayankmathur looks like there's some limitations with accessing the Pages API based on the docs:

Information about the site and the builds can only be accessed by authenticated owners, even though the websites are public.

This is going to cause headaches, and perhaps we need to do this setup:

  • create the repository
  • publish something to gh-pages
  • check build staus
  • teardown the repository

This will likely mean most of the tests here are excessive...

@prayankmathur
Copy link
Contributor Author

@shiftkey
So i should remove those excessive tests and then maybe open up a separate issue to create this setup ?

@shiftkey
Copy link
Member

@prayankmathur that sounds great! Leave one test with an "[IntegrationTest(Skip= "These tests require repository admin rights - see https://github.com/octokit/octokit.net/issues/XXX for discussion")] so we can link to the related discussion...

@prayankmathur
Copy link
Contributor Author

@shiftkey
How do I know that appveyor is running/skipping the test that i mentioned to skip ?

@shiftkey
Copy link
Member

@shiftkey
Copy link
Member

I'm not sure what the current state of this PR is, so I'm moving this to #1304 so I can merge this new code in (with the skipped test).

@shiftkey shiftkey closed this May 18, 2016
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.

4 participants