mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-02 19:00:47 +00:00
Admin rights tests stripped down
This commit is contained in:
@@ -17,105 +17,11 @@ public class RepositoryPagesClientTests
|
||||
_repositoryPagesClient = github.Repository.Page;
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
[IntegrationTest(Skip= "These tests require repository admin rights - see https://github.com/octokit/octokit.net/issues/1263 for discussion")]
|
||||
public async Task ReturnsMetadata()
|
||||
{
|
||||
var data = await _repositoryPagesClient.Get(owner, name);
|
||||
Assert.Equal("https://api.github.com/repos/octokit/octokit.net/pages", data.Url);
|
||||
}
|
||||
}
|
||||
|
||||
public class TheGetAllMethod
|
||||
{
|
||||
readonly IRepositoryPagesClient _repositoryPagesClient;
|
||||
const string owner = "octokit";
|
||||
const string name = "octokit.net";
|
||||
|
||||
public TheGetAllMethod()
|
||||
{
|
||||
var github = Helper.GetAuthenticatedClient();
|
||||
_repositoryPagesClient = github.Repository.Page;
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task ReturnsPages()
|
||||
{
|
||||
var pages = await _repositoryPagesClient.GetAll(owner, name);
|
||||
Assert.NotEmpty(pages);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task ReturnsCorrectCountOfPagesWithoutStart()
|
||||
{
|
||||
var options = new ApiOptions
|
||||
{
|
||||
PageSize = 5,
|
||||
PageCount = 1
|
||||
};
|
||||
|
||||
var pages = await _repositoryPagesClient.GetAll(owner, name, options);
|
||||
Assert.Equal(5, pages.Count);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task ReturnCorrectCountOfPagesWithStart()
|
||||
{
|
||||
var options = new ApiOptions
|
||||
{
|
||||
PageSize = 5,
|
||||
PageCount = 1,
|
||||
StartPage = 2
|
||||
};
|
||||
|
||||
var pages = await _repositoryPagesClient.GetAll(owner, name, options);
|
||||
Assert.Equal(5, pages.Count);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task ReturnsDistinctResultsBasedOnStartPage()
|
||||
{
|
||||
var startOptions = new ApiOptions
|
||||
{
|
||||
PageSize = 5,
|
||||
PageCount = 1
|
||||
};
|
||||
|
||||
var firstPage = await _repositoryPagesClient.GetAll(owner, name, startOptions);
|
||||
|
||||
var skipStartOptions = new ApiOptions
|
||||
{
|
||||
PageSize = 5,
|
||||
PageCount = 1,
|
||||
StartPage = 2
|
||||
};
|
||||
|
||||
var secondPage = await _repositoryPagesClient.GetAll(owner, name, skipStartOptions);
|
||||
|
||||
Assert.NotEqual(firstPage[0].Url, secondPage[0].Url);
|
||||
Assert.NotEqual(firstPage[1].Url, secondPage[1].Url);
|
||||
Assert.NotEqual(firstPage[2].Url, secondPage[2].Url);
|
||||
Assert.NotEqual(firstPage[3].Url, secondPage[3].Url);
|
||||
Assert.NotEqual(firstPage[4].Url, secondPage[4].Url);
|
||||
}
|
||||
|
||||
public class TheGetLatestMethod
|
||||
{
|
||||
readonly IRepositoryPagesClient _repositoryPagesClient;
|
||||
const string owner = "octokit";
|
||||
const string name = "octokit.net";
|
||||
|
||||
public TheGetLatestMethod()
|
||||
{
|
||||
_repositoryPagesClient = Helper.GetAuthenticatedClient().Repository.Page;
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task ReturnsMetadata()
|
||||
{
|
||||
var data = _repositoryPagesClient.GetLatest(owner, name);
|
||||
|
||||
Assert.NotNull(data.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user