[FEAT] Updates permissions for App Installations and Collaborators endpoints

This commit is contained in:
notauserx
2023-03-08 22:27:29 +06:00
committed by GitHub
parent b5cf402032
commit 1300427bdd
27 changed files with 736 additions and 461 deletions
@@ -68,7 +68,7 @@ namespace Octokit.Tests.Reactive
_client.GetAll(owner, name);
_githubClient.Connection.Received(1)
.Get<List<User>>(Arg.Is<Uri>(u => u.ToString() == expectedUrl),
.Get<List<Collaborator>>(Arg.Is<Uri>(u => u.ToString() == expectedUrl),
Arg.Is<IDictionary<string, string>>(dictionary => dictionary.Count == 1));
}
@@ -79,7 +79,7 @@ namespace Octokit.Tests.Reactive
_client.GetAll(repositoryId);
_githubClient.Connection.Received(1)
.Get<List<User>>(Arg.Is<Uri>(u => u.ToString() == expectedUrl),
.Get<List<Collaborator>>(Arg.Is<Uri>(u => u.ToString() == expectedUrl),
Arg.Is<IDictionary<string, string>>(dictionary => dictionary.Count == 1));
}
@@ -98,7 +98,7 @@ namespace Octokit.Tests.Reactive
_client.GetAll(owner, name, options);
_githubClient.Connection.Received(1)
.Get<List<User>>(Arg.Is<Uri>(u => u.ToString() == expectedUrl),
.Get<List<Collaborator>>(Arg.Is<Uri>(u => u.ToString() == expectedUrl),
Arg.Is<IDictionary<string, string>>(dictionary => dictionary.Count == 3));
// StartPage is setted => only 1 option (StartPage) in dictionary
@@ -109,7 +109,7 @@ namespace Octokit.Tests.Reactive
_client.GetAll(owner, name, options);
_githubClient.Connection.Received(1)
.Get<List<User>>(Arg.Is<Uri>(u => u.ToString() == expectedUrl),
.Get<List<Collaborator>>(Arg.Is<Uri>(u => u.ToString() == expectedUrl),
Arg.Is<IDictionary<string, string>>(dictionary => dictionary.Count == 2));
// PageCount is setted => none of options in dictionary
@@ -120,7 +120,7 @@ namespace Octokit.Tests.Reactive
_client.GetAll(owner, name, options);
_githubClient.Connection.Received(1)
.Get<List<User>>(Arg.Is<Uri>(u => u.ToString() == expectedUrl),
.Get<List<Collaborator>>(Arg.Is<Uri>(u => u.ToString() == expectedUrl),
Arg.Is<IDictionary<string, string>>(dictionary => dictionary.Count == 1));
}
@@ -133,7 +133,7 @@ namespace Octokit.Tests.Reactive
_client.GetAll(owner, name, request);
_githubClient.Connection.Received(1)
.Get<List<User>>(Arg.Is<Uri>(u => u.ToString() == expectedUrl),
.Get<List<Collaborator>>(Arg.Is<Uri>(u => u.ToString() == expectedUrl),
Arg.Is<IDictionary<string, string>>(d => d["affiliation"] == "all"));
request = new RepositoryCollaboratorListRequest
@@ -143,7 +143,7 @@ namespace Octokit.Tests.Reactive
_client.GetAll(owner, name, request);
_githubClient.Connection.Received(1)
.Get<List<User>>(Arg.Is<Uri>(u => u.ToString() == expectedUrl),
.Get<List<Collaborator>>(Arg.Is<Uri>(u => u.ToString() == expectedUrl),
Arg.Is<IDictionary<string, string>>(d => d["affiliation"] == "direct"));
// PageCount is setted => none of options in dictionary
@@ -154,7 +154,7 @@ namespace Octokit.Tests.Reactive
_client.GetAll(owner, name, request);
_githubClient.Connection.Received(1)
.Get<List<User>>(Arg.Is<Uri>(u => u.ToString() == expectedUrl),
.Get<List<Collaborator>>(Arg.Is<Uri>(u => u.ToString() == expectedUrl),
Arg.Is<IDictionary<string, string>>(d => d["affiliation"] == "outside"));
}
@@ -173,7 +173,7 @@ namespace Octokit.Tests.Reactive
_client.GetAll(repositoryId, options);
_githubClient.Connection.Received(1)
.Get<List<User>>(Arg.Is<Uri>(u => u.ToString() == expectedUrl),
.Get<List<Collaborator>>(Arg.Is<Uri>(u => u.ToString() == expectedUrl),
Arg.Is<IDictionary<string, string>>(dictionary => dictionary.Count == 3));
// StartPage is setted => only 1 option (StartPage) in dictionary
@@ -184,7 +184,7 @@ namespace Octokit.Tests.Reactive
_client.GetAll(repositoryId, options);
_githubClient.Connection.Received(1)
.Get<List<User>>(Arg.Is<Uri>(u => u.ToString() == expectedUrl),
.Get<List<Collaborator>>(Arg.Is<Uri>(u => u.ToString() == expectedUrl),
Arg.Is<IDictionary<string, string>>(dictionary => dictionary.Count == 2));
// PageCount is setted => none of options in dictionary
@@ -195,7 +195,7 @@ namespace Octokit.Tests.Reactive
_client.GetAll(repositoryId, options);
_githubClient.Connection.Received(1)
.Get<List<User>>(Arg.Is<Uri>(u => u.ToString() == expectedUrl),
.Get<List<Collaborator>>(Arg.Is<Uri>(u => u.ToString() == expectedUrl),
Arg.Is<IDictionary<string, string>>(dictionary => dictionary.Count == 1));
}
@@ -208,7 +208,7 @@ namespace Octokit.Tests.Reactive
_client.GetAll(repositoryId, request);
_githubClient.Connection.Received(1)
.Get<List<User>>(Arg.Is<Uri>(u => u.ToString() == expectedUrl),
.Get<List<Collaborator>>(Arg.Is<Uri>(u => u.ToString() == expectedUrl),
Arg.Is<IDictionary<string, string>>(d => d["affiliation"] == "all"));
request = new RepositoryCollaboratorListRequest
@@ -218,7 +218,7 @@ namespace Octokit.Tests.Reactive
_client.GetAll(repositoryId, request);
_githubClient.Connection.Received(1)
.Get<List<User>>(Arg.Is<Uri>(u => u.ToString() == expectedUrl),
.Get<List<Collaborator>>(Arg.Is<Uri>(u => u.ToString() == expectedUrl),
Arg.Is<IDictionary<string, string>>(d => d["affiliation"] == "direct"));
request = new RepositoryCollaboratorListRequest
@@ -228,7 +228,7 @@ namespace Octokit.Tests.Reactive
_client.GetAll(repositoryId, request);
_githubClient.Connection.Received(1)
.Get<List<User>>(Arg.Is<Uri>(u => u.ToString() == expectedUrl),
.Get<List<Collaborator>>(Arg.Is<Uri>(u => u.ToString() == expectedUrl),
Arg.Is<IDictionary<string, string>>(d => d["affiliation"] == "outside"));
}
}
@@ -507,7 +507,7 @@ namespace Octokit.Tests.Reactive
public void EnsuresNonNullArguments()
{
SetupWithNonReactiveClient();
var permission = new CollaboratorRequest(Permission.Push);
var permission = new CollaboratorRequest("push");
Assert.Throws<ArgumentNullException>(() => _client.Invite(null, "repo", "user", permission));
Assert.Throws<ArgumentNullException>(() => _client.Invite("owner", null, "user", permission));
@@ -519,7 +519,7 @@ namespace Octokit.Tests.Reactive
public void EnsuresNonEmptyArguments()
{
SetupWithNonReactiveClient();
var permission = new CollaboratorRequest(Permission.Push);
var permission = new CollaboratorRequest("push");
Assert.Throws<ArgumentException>(() => _client.Invite("", "repo", "user", permission));
Assert.Throws<ArgumentException>(() => _client.Invite("owner", "", "user", permission));
@@ -530,7 +530,7 @@ namespace Octokit.Tests.Reactive
public async Task EnsuresNonWhitespaceArguments()
{
SetupWithNonReactiveClient();
var permission = new CollaboratorRequest(Permission.Push);
var permission = new CollaboratorRequest("push");
await AssertEx.ThrowsWhenGivenWhitespaceArgument(
async whitespace => await _client.Invite(whitespace, "repo", "user", permission));
@@ -544,7 +544,7 @@ namespace Octokit.Tests.Reactive
public void CallsInviteOnRegularDeploymentsClient()
{
SetupWithoutNonReactiveClient();
var permission = new CollaboratorRequest(Permission.Push);
var permission = new CollaboratorRequest("push");
_client.Invite("owner", "repo", "user", permission);