Skip to content

Commit

Permalink
update tests to use full accept header
Browse files Browse the repository at this point in the history
  • Loading branch information
shiftkey committed Mar 6, 2020
1 parent e7ed27c commit 50ef496
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions Octokit.Tests/Clients/IssueTimelineClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public async Task RequestsTheCorrectUrl()
connection.Received().GetAll<TimelineEventInfo>(
Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/42/timeline"),
Arg.Any<Dictionary<string, string>>(),
"application/vnd.github.mockingbird-preview,application/vnd.github.starfox-preview",
"application/vnd.github.mockingbird-preview+json,application/vnd.github.starfox-preview",
Arg.Any<ApiOptions>());
}

Expand All @@ -46,7 +46,7 @@ public async Task RequestsTheCorrectUrlWithApiOptions()
connection.Received().GetAll<TimelineEventInfo>(
Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/42/timeline"),
Arg.Any<Dictionary<string, string>>(),
"application/vnd.github.mockingbird-preview,application/vnd.github.starfox-preview",
"application/vnd.github.mockingbird-preview+json,application/vnd.github.starfox-preview",
Arg.Is<ApiOptions>(ao => ao.PageSize == 30));
}

Expand All @@ -61,7 +61,7 @@ public async Task RequestsTheCorrectUrlWithRepositoryId()
connection.Received().GetAll<TimelineEventInfo>(
Arg.Is<Uri>(u => u.ToString() == "repositories/1/issues/42/timeline"),
Arg.Any<Dictionary<string, string>>(),
"application/vnd.github.mockingbird-preview,application/vnd.github.starfox-preview",
"application/vnd.github.mockingbird-preview+json,application/vnd.github.starfox-preview",
Arg.Any<ApiOptions>());
}

Expand All @@ -76,7 +76,7 @@ public async Task RequestsTheCorrectUrlWithRepositoryIdAndApiOptions()
connection.Received().GetAll<TimelineEventInfo>(
Arg.Is<Uri>(u => u.ToString() == "repositories/1/issues/42/timeline"),
Arg.Any<Dictionary<string, string>>(),
"application/vnd.github.mockingbird-preview,application/vnd.github.starfox-preview",
"application/vnd.github.mockingbird-preview+json,application/vnd.github.starfox-preview",
Arg.Is<ApiOptions>(ao => ao.PageSize == 30));
}

Expand Down
16 changes: 8 additions & 8 deletions Octokit.Tests/Reactive/ObservableIssueTimelineClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ public async Task RequestsCorrectUrl()
{
ApiInfo = new ApiInfo(new Dictionary<string, Uri>(), new List<string>(), new List<string>(), "etag", new RateLimit()),
}, result);
gitHubClient.Connection.Get<List<TimelineEventInfo>>(Args.Uri, Args.EmptyDictionary, "application/vnd.github.mockingbird-preview")
gitHubClient.Connection.Get<List<TimelineEventInfo>>(Args.Uri, Args.EmptyDictionary, "application/vnd.github.mockingbird-preview+json")
.Returns(Task.FromResult(response));

var timelineEvents = await client.GetAllForIssue("fake", "repo", 42).ToList();

connection.Received().Get<List<TimelineEventInfo>>(
Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/42/timeline"),
Arg.Any<Dictionary<string, string>>(),
"application/vnd.github.mockingbird-preview");
"application/vnd.github.mockingbird-preview+json");
Assert.Equal(1, timelineEvents.Count);
}

Expand All @@ -63,15 +63,15 @@ public async Task RequestsCorrectUrlWithApiOptions()
{
ApiInfo = new ApiInfo(new Dictionary<string, Uri>(), new List<string>(), new List<string>(), "etag", new RateLimit()),
}, result);
gitHubClient.Connection.Get<List<TimelineEventInfo>>(Args.Uri, Arg.Is<Dictionary<string, string>>(d => d.Count == 1), "application/vnd.github.mockingbird-preview")
gitHubClient.Connection.Get<List<TimelineEventInfo>>(Args.Uri, Arg.Is<Dictionary<string, string>>(d => d.Count == 1), "application/vnd.github.mockingbird-preview+json")
.Returns(Task.FromResult(response));

var timelineEvents = await client.GetAllForIssue("fake", "repo", 42, new ApiOptions { PageSize = 30 }).ToList();

connection.Received().Get<List<TimelineEventInfo>>(
Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/42/timeline"),
Arg.Is<Dictionary<string, string>>(d => d.Count == 1 && d["per_page"] == "30"),
"application/vnd.github.mockingbird-preview");
"application/vnd.github.mockingbird-preview+json");
Assert.Equal(1, timelineEvents.Count);
}

Expand All @@ -88,15 +88,15 @@ public async Task RequestCorrectUrlWithRepositoryId()
{
ApiInfo = new ApiInfo(new Dictionary<string, Uri>(), new List<string>(), new List<string>(), "etag", new RateLimit()),
}, result);
githubClient.Connection.Get<List<TimelineEventInfo>>(Args.Uri, Args.EmptyDictionary, "application/vnd.github.mockingbird-preview")
githubClient.Connection.Get<List<TimelineEventInfo>>(Args.Uri, Args.EmptyDictionary, "application/vnd.github.mockingbird-preview+json")
.Returns(Task.FromResult(response));

var timelineEvents = await client.GetAllForIssue(1, 42).ToList();

connection.Received().Get<List<TimelineEventInfo>>(
Arg.Is<Uri>(u => u.ToString() == "repositories/1/issues/42/timeline"),
Arg.Any<Dictionary<string, string>>(),
"application/vnd.github.mockingbird-preview");
"application/vnd.github.mockingbird-preview+json");
Assert.Equal(1, timelineEvents.Count);
}

Expand All @@ -113,15 +113,15 @@ public async Task RequestCorrectUrlWithRepositoryIdAndApiOptions()
{
ApiInfo = new ApiInfo(new Dictionary<string, Uri>(), new List<string>(), new List<string>(), "etag", new RateLimit()),
}, result);
githubClient.Connection.Get<List<TimelineEventInfo>>(Args.Uri, Arg.Is<Dictionary<string, string>>(d => d.Count == 1), "application/vnd.github.mockingbird-preview")
githubClient.Connection.Get<List<TimelineEventInfo>>(Args.Uri, Arg.Is<Dictionary<string, string>>(d => d.Count == 1), "application/vnd.github.mockingbird-preview+json")
.Returns(Task.FromResult(response));

var timelineEvents = await client.GetAllForIssue(1, 42, new ApiOptions { PageSize = 30 }).ToList();

connection.Received().Get<List<TimelineEventInfo>>(
Arg.Is<Uri>(u => u.ToString() == "repositories/1/issues/42/timeline"),
Arg.Is<Dictionary<string, string>>(d => d.Count == 1 && d["per_page"] == "30"),
"application/vnd.github.mockingbird-preview");
"application/vnd.github.mockingbird-preview+json");
Assert.Equal(1, timelineEvents.Count);
}

Expand Down

0 comments on commit 50ef496

Please sign in to comment.