mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-07 20:30:41 +00:00
Add exception for exceeding the private quota
This commit is contained in:
@@ -9,7 +9,7 @@ using Octokit.Tests.Helpers;
|
||||
|
||||
public class RepositoriesClientTests
|
||||
{
|
||||
public class TheCreateMethodForUser
|
||||
public class TheCreateMethodForUser : IDisposable
|
||||
{
|
||||
[IntegrationTest]
|
||||
public async Task CreatesANewPublicRepository()
|
||||
@@ -287,6 +287,45 @@ public class RepositoriesClientTests
|
||||
Helper.DeleteRepo(createdRepository);
|
||||
}
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task ThrowsPrivateRepositoryQuotaExceededExceptionWhenOverQuota()
|
||||
{
|
||||
var github = new GitHubClient(new ProductHeaderValue("OctokitTests"))
|
||||
{
|
||||
Credentials = Helper.Credentials
|
||||
};
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
var repoName = Helper.MakeNameWithTimestamp("private-repo" + i);
|
||||
var repository = new NewRepository { Name = repoName, Private = true };
|
||||
await github.Repository.Create(repository);
|
||||
}
|
||||
|
||||
var thrown = await AssertEx.Throws<PrivateRepositoryQuotaExceededException>(
|
||||
async () => await github.Repository.Create(new NewRepository { Name = "x-private", Private = true }));
|
||||
Assert.NotNull(thrown);
|
||||
}
|
||||
|
||||
// Clean up the repos.
|
||||
public void Dispose()
|
||||
{
|
||||
var github = new GitHubClient(new ProductHeaderValue("OctokitTests"))
|
||||
{
|
||||
Credentials = Helper.Credentials
|
||||
};
|
||||
var repositories = github.Repository.GetAllForCurrent().Result;
|
||||
|
||||
foreach (var repository in repositories)
|
||||
{
|
||||
try
|
||||
{
|
||||
github.Repository.Delete(repository.Owner.Login, repository.Name).Wait();
|
||||
}
|
||||
catch (Exception) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class TheCreateMethodForOrganization
|
||||
|
||||
Reference in New Issue
Block a user