feat: Removing accept header previews (#2515)

This commit is contained in:
Chris Simpson
2022-08-01 15:37:23 +01:00
committed by GitHub
parent 840935a8d7
commit 2f7bd00dd6
138 changed files with 954 additions and 1659 deletions
@@ -128,12 +128,11 @@ namespace Octokit.Tests.Reactive
);
var gitHubClient = Substitute.For<IGitHubClient>();
var acceptHeader = "application/vnd.github.squirrel-girl-preview+json";
gitHubClient.Connection.Get<List<PullRequestReviewComment>>(firstPageUrl, Args.EmptyDictionary, acceptHeader)
gitHubClient.Connection.Get<List<PullRequestReviewComment>>(firstPageUrl, Args.EmptyDictionary)
.Returns(Task.FromResult<IApiResponse<List<PullRequestReviewComment>>>(firstPageResponse));
gitHubClient.Connection.Get<List<PullRequestReviewComment>>(secondPageUrl, Args.EmptyDictionary, acceptHeader)
gitHubClient.Connection.Get<List<PullRequestReviewComment>>(secondPageUrl, Args.EmptyDictionary)
.Returns(Task.FromResult<IApiResponse<List<PullRequestReviewComment>>>(secondPageResponse));
gitHubClient.Connection.Get<List<PullRequestReviewComment>>(thirdPageUrl, Args.EmptyDictionary, acceptHeader)
gitHubClient.Connection.Get<List<PullRequestReviewComment>>(thirdPageUrl, Args.EmptyDictionary)
.Returns(Task.FromResult<IApiResponse<List<PullRequestReviewComment>>>(lastPageResponse));
var client = new ObservablePullRequestReviewCommentsClient(gitHubClient);
@@ -141,9 +140,9 @@ namespace Octokit.Tests.Reactive
var results = await client.GetAll("owner", "name", 7).ToArray();
Assert.Equal(7, results.Length);
gitHubClient.Connection.Received(1).Get<List<PullRequestReviewComment>>(firstPageUrl, Args.EmptyDictionary, acceptHeader);
gitHubClient.Connection.Received(1).Get<List<PullRequestReviewComment>>(secondPageUrl, Args.EmptyDictionary, acceptHeader);
gitHubClient.Connection.Received(1).Get<List<PullRequestReviewComment>>(thirdPageUrl, Args.EmptyDictionary, acceptHeader);
gitHubClient.Connection.Received(1).Get<List<PullRequestReviewComment>>(firstPageUrl, Args.EmptyDictionary);
gitHubClient.Connection.Received(1).Get<List<PullRequestReviewComment>>(secondPageUrl, Args.EmptyDictionary);
gitHubClient.Connection.Received(1).Get<List<PullRequestReviewComment>>(thirdPageUrl, Args.EmptyDictionary);
}
[Fact]
@@ -183,11 +182,11 @@ namespace Octokit.Tests.Reactive
);
var gitHubClient = Substitute.For<IGitHubClient>();
gitHubClient.Connection.Get<List<PullRequestReviewComment>>(firstPageUrl, Args.EmptyDictionary, null)
gitHubClient.Connection.Get<List<PullRequestReviewComment>>(firstPageUrl, Args.EmptyDictionary)
.Returns(Task.FromResult<IApiResponse<List<PullRequestReviewComment>>>(firstPageResponse));
gitHubClient.Connection.Get<List<PullRequestReviewComment>>(secondPageUrl, Args.EmptyDictionary, null)
gitHubClient.Connection.Get<List<PullRequestReviewComment>>(secondPageUrl, Args.EmptyDictionary)
.Returns(Task.FromResult<IApiResponse<List<PullRequestReviewComment>>>(secondPageResponse));
gitHubClient.Connection.Get<List<PullRequestReviewComment>>(thirdPageUrl, Args.EmptyDictionary, null)
gitHubClient.Connection.Get<List<PullRequestReviewComment>>(thirdPageUrl, Args.EmptyDictionary)
.Returns(Task.FromResult<IApiResponse<List<PullRequestReviewComment>>>(lastPageResponse));
var client = new ObservablePullRequestReviewCommentsClient(gitHubClient);
@@ -195,9 +194,9 @@ namespace Octokit.Tests.Reactive
var results = await client.GetAll(1, 7).ToArray();
Assert.Equal(7, results.Length);
gitHubClient.Connection.Received(1).Get<List<PullRequestReviewComment>>(firstPageUrl, Args.EmptyDictionary, null);
gitHubClient.Connection.Received(1).Get<List<PullRequestReviewComment>>(secondPageUrl, Args.EmptyDictionary, null);
gitHubClient.Connection.Received(1).Get<List<PullRequestReviewComment>>(thirdPageUrl, Args.EmptyDictionary, null);
gitHubClient.Connection.Received(1).Get<List<PullRequestReviewComment>>(firstPageUrl, Args.EmptyDictionary);
gitHubClient.Connection.Received(1).Get<List<PullRequestReviewComment>>(secondPageUrl, Args.EmptyDictionary);
gitHubClient.Connection.Received(1).Get<List<PullRequestReviewComment>>(thirdPageUrl, Args.EmptyDictionary);
}
[Fact]
@@ -347,23 +346,22 @@ namespace Octokit.Tests.Reactive
);
var gitHubClient = Substitute.For<IGitHubClient>();
var previewAcceptHeader = "application/vnd.github.squirrel-girl-preview+json";
gitHubClient.Connection.Get<List<PullRequestReviewComment>>(firstPageUrl,
Arg.Is<Dictionary<string, string>>(d => d.Count == 3
&& d["direction"] == "desc"
&& d["since"] == "2013-11-15T11:43:01Z"
&& d["sort"] == "updated"), previewAcceptHeader)
&& d["sort"] == "updated"))
.Returns(Task.FromResult<IApiResponse<List<PullRequestReviewComment>>>(firstPageResponse));
gitHubClient.Connection.Get<List<PullRequestReviewComment>>(secondPageUrl, Arg.Is<Dictionary<string, string>>(d => d.Count == 3
&& d["direction"] == "desc"
&& d["since"] == "2013-11-15T11:43:01Z"
&& d["sort"] == "updated"), previewAcceptHeader)
&& d["sort"] == "updated"))
.Returns(Task.FromResult<IApiResponse<List<PullRequestReviewComment>>>(secondPageResponse));
gitHubClient.Connection.Get<List<PullRequestReviewComment>>(thirdPageUrl, Arg.Is<Dictionary<string, string>>(d => d.Count == 3
&& d["direction"] == "desc"
&& d["since"] == "2013-11-15T11:43:01Z"
&& d["sort"] == "updated"), previewAcceptHeader)
&& d["sort"] == "updated"))
.Returns(Task.FromResult<IApiResponse<List<PullRequestReviewComment>>>(lastPageResponse));
var client = new ObservablePullRequestReviewCommentsClient(gitHubClient);
@@ -382,15 +380,15 @@ namespace Octokit.Tests.Reactive
Arg.Is<Dictionary<string, string>>(d => d.Count == 3
&& d["direction"] == "desc"
&& d["since"] == "2013-11-15T11:43:01Z"
&& d["sort"] == "updated"), previewAcceptHeader);
&& d["sort"] == "updated"));
gitHubClient.Connection.Received(1).Get<List<PullRequestReviewComment>>(secondPageUrl, Arg.Is<Dictionary<string, string>>(d => d.Count == 3
&& d["direction"] == "desc"
&& d["since"] == "2013-11-15T11:43:01Z"
&& d["sort"] == "updated"), previewAcceptHeader);
&& d["sort"] == "updated"));
gitHubClient.Connection.Received(1).Get<List<PullRequestReviewComment>>(thirdPageUrl, Arg.Is<Dictionary<string, string>>(d => d.Count == 3
&& d["direction"] == "desc"
&& d["since"] == "2013-11-15T11:43:01Z"
&& d["sort"] == "updated"), previewAcceptHeader);
&& d["sort"] == "updated"));
}
[Fact]
@@ -436,17 +434,17 @@ namespace Octokit.Tests.Reactive
Arg.Is<Dictionary<string, string>>(d => d.Count == 3
&& d["direction"] == "desc"
&& d["since"] == "2013-11-15T11:43:01Z"
&& d["sort"] == "updated"), "application/vnd.github.squirrel-girl-preview+json")
&& d["sort"] == "updated"))
.Returns(Task.FromResult<IApiResponse<List<PullRequestReviewComment>>>(firstPageResponse));
gitHubClient.Connection.Get<List<PullRequestReviewComment>>(secondPageUrl, Arg.Is<Dictionary<string, string>>(d => d.Count == 3
&& d["direction"] == "desc"
&& d["since"] == "2013-11-15T11:43:01Z"
&& d["sort"] == "updated"), "application/vnd.github.squirrel-girl-preview+json")
&& d["sort"] == "updated"))
.Returns(Task.FromResult<IApiResponse<List<PullRequestReviewComment>>>(secondPageResponse));
gitHubClient.Connection.Get<List<PullRequestReviewComment>>(thirdPageUrl, Arg.Is<Dictionary<string, string>>(d => d.Count == 3
&& d["direction"] == "desc"
&& d["since"] == "2013-11-15T11:43:01Z"
&& d["sort"] == "updated"), "application/vnd.github.squirrel-girl-preview+json")
&& d["sort"] == "updated"))
.Returns(Task.FromResult<IApiResponse<List<PullRequestReviewComment>>>(lastPageResponse));
var client = new ObservablePullRequestReviewCommentsClient(gitHubClient);
@@ -465,15 +463,15 @@ namespace Octokit.Tests.Reactive
Arg.Is<Dictionary<string, string>>(d => d.Count == 3
&& d["direction"] == "desc"
&& d["since"] == "2013-11-15T11:43:01Z"
&& d["sort"] == "updated"), "application/vnd.github.squirrel-girl-preview+json");
&& d["sort"] == "updated"));
gitHubClient.Connection.Received(1).Get<List<PullRequestReviewComment>>(secondPageUrl, Arg.Is<Dictionary<string, string>>(d => d.Count == 3
&& d["direction"] == "desc"
&& d["since"] == "2013-11-15T11:43:01Z"
&& d["sort"] == "updated"), "application/vnd.github.squirrel-girl-preview+json");
&& d["sort"] == "updated"));
gitHubClient.Connection.Received(1).Get<List<PullRequestReviewComment>>(thirdPageUrl, Arg.Is<Dictionary<string, string>>(d => d.Count == 3
&& d["direction"] == "desc"
&& d["since"] == "2013-11-15T11:43:01Z"
&& d["sort"] == "updated"), "application/vnd.github.squirrel-girl-preview+json");
&& d["sort"] == "updated"));
}
[Fact]
@@ -573,20 +571,18 @@ namespace Octokit.Tests.Reactive
var gitHubClient = Substitute.For<IGitHubClient>();
var previewAcceptHeader = "application/vnd.github.squirrel-girl-preview+json";
gitHubClient.Connection.Get<List<PullRequestReviewComment>>(firstPageUrl,
Arg.Is<Dictionary<string, string>>(d => d.Count == 2
&& d["direction"] == "asc"
&& d["sort"] == "created"), previewAcceptHeader)
&& d["sort"] == "created"))
.Returns(Task.FromResult<IApiResponse<List<PullRequestReviewComment>>>(firstPageResponse));
gitHubClient.Connection.Get<List<PullRequestReviewComment>>(secondPageUrl, Arg.Is<Dictionary<string, string>>(d => d.Count == 2
&& d["direction"] == "asc"
&& d["sort"] == "created"), previewAcceptHeader)
&& d["sort"] == "created"))
.Returns(Task.FromResult<IApiResponse<List<PullRequestReviewComment>>>(secondPageResponse));
gitHubClient.Connection.Get<List<PullRequestReviewComment>>(thirdPageUrl, Arg.Is<Dictionary<string, string>>(d => d.Count == 2
&& d["direction"] == "asc"
&& d["sort"] == "created"), previewAcceptHeader)
&& d["sort"] == "created"))
.Returns(Task.FromResult<IApiResponse<List<PullRequestReviewComment>>>(lastPageResponse));
var client = new ObservablePullRequestReviewCommentsClient(gitHubClient);
@@ -597,13 +593,13 @@ namespace Octokit.Tests.Reactive
gitHubClient.Connection.Received(1).Get<List<PullRequestReviewComment>>(firstPageUrl,
Arg.Is<Dictionary<string, string>>(d => d.Count == 2
&& d["direction"] == "asc"
&& d["sort"] == "created"), previewAcceptHeader);
&& d["sort"] == "created"));
gitHubClient.Connection.Received(1).Get<List<PullRequestReviewComment>>(secondPageUrl, Arg.Is<Dictionary<string, string>>(d => d.Count == 2
&& d["direction"] == "asc"
&& d["sort"] == "created"), previewAcceptHeader);
&& d["sort"] == "created"));
gitHubClient.Connection.Received(1).Get<List<PullRequestReviewComment>>(thirdPageUrl, Arg.Is<Dictionary<string, string>>(d => d.Count == 2
&& d["direction"] == "asc"
&& d["sort"] == "created"), previewAcceptHeader);
&& d["sort"] == "created"));
}
[Fact]
@@ -648,15 +644,15 @@ namespace Octokit.Tests.Reactive
gitHubClient.Connection.Get<List<PullRequestReviewComment>>(firstPageUrl,
Arg.Is<Dictionary<string, string>>(d => d.Count == 2
&& d["direction"] == "asc"
&& d["sort"] == "created"), "application/vnd.github.squirrel-girl-preview+json")
&& d["sort"] == "created"))
.Returns(Task.FromResult<IApiResponse<List<PullRequestReviewComment>>>(firstPageResponse));
gitHubClient.Connection.Get<List<PullRequestReviewComment>>(secondPageUrl, Arg.Is<Dictionary<string, string>>(d => d.Count == 2
&& d["direction"] == "asc"
&& d["sort"] == "created"), "application/vnd.github.squirrel-girl-preview+json")
&& d["sort"] == "created"))
.Returns(Task.FromResult<IApiResponse<List<PullRequestReviewComment>>>(secondPageResponse));
gitHubClient.Connection.Get<List<PullRequestReviewComment>>(thirdPageUrl, Arg.Is<Dictionary<string, string>>(d => d.Count == 2
&& d["direction"] == "asc"
&& d["sort"] == "created"), "application/vnd.github.squirrel-girl-preview+json")
&& d["sort"] == "created"))
.Returns(Task.FromResult<IApiResponse<List<PullRequestReviewComment>>>(lastPageResponse));
var client = new ObservablePullRequestReviewCommentsClient(gitHubClient);
@@ -667,15 +663,13 @@ namespace Octokit.Tests.Reactive
gitHubClient.Connection.Received(1).Get<List<PullRequestReviewComment>>(firstPageUrl,
Arg.Is<Dictionary<string, string>>(d => d.Count == 2
&& d["direction"] == "asc"
&& d["sort"] == "created"),
"application/vnd.github.squirrel-girl-preview+json");
&& d["sort"] == "created"));
gitHubClient.Connection.Received(1).Get<List<PullRequestReviewComment>>(secondPageUrl, Arg.Is<Dictionary<string, string>>(d => d.Count == 2
&& d["direction"] == "asc"
&& d["sort"] == "created"),
"application/vnd.github.squirrel-girl-preview+json");
&& d["sort"] == "created"));
gitHubClient.Connection.Received(1).Get<List<PullRequestReviewComment>>(thirdPageUrl, Arg.Is<Dictionary<string, string>>(d => d.Count == 2
&& d["direction"] == "asc"
&& d["sort"] == "created"), "application/vnd.github.squirrel-girl-preview+json");
&& d["sort"] == "created"));
}
[Fact]