Skip to content

Commit

Permalink
updates tests to include new fields for the meta resource (#2581)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickfloyd authored Sep 20, 2022
1 parent 3e5c549 commit a7ffa3f
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions Octokit.Tests/Clients/MetaClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,40 @@ public class TheGetMetadataMethod
[Fact]
public async Task RequestsTheMetadataEndpoint()
{
var meta = new Meta(
var meta = new Meta(
false,
"12345ABCDE",
new[] { "1.1.1.1/24", "1.1.1.2/24" },
new[] { "1.1.2.1/24", "1.1.2.2/24" },
new[] { "1.1.3.1/24", "1.1.3.2/24" },
new[] { "1.1.4.1", "1.1.4.2" }
new[] { "1.1.4.1/24", "1.1.4.2/24" },
new[] { "1.1.5.1/24", "1.1.5.2/24" },
new[] { "1.1.6.1/24", "1.1.6.2/24" },
new[] { "1.1.7.1", "1.1.7.2" },
new[] { "1.1.8.1/24", "1.1.8.2/24" },
new[] { "1.1.9.1", "1.1.9.2" }
);


var apiConnection = Substitute.For<IApiConnection>();
apiConnection.Get<Meta>(Arg.Is<Uri>(u => u.ToString() == "meta")).Returns(Task.FromResult(meta));
var client = new MetaClient(apiConnection);

var result = await client.GetMetadata();

Assert.False(result.VerifiablePasswordAuthentication);
#pragma warning disable CS0618 // Type or member is obsolete
Assert.Equal("12345ABCDE", result.GitHubServicesSha);
#pragma warning restore CS0618 // Type or member is obsolete
Assert.Equal(result.Hooks, new[] { "1.1.1.1/24", "1.1.1.2/24" });
Assert.Equal(result.Git, new[] { "1.1.2.1/24", "1.1.2.2/24" });
Assert.Equal(result.Pages, new[] { "1.1.3.1/24", "1.1.3.2/24" });
Assert.Equal(result.Importer, new[] { "1.1.4.1", "1.1.4.2" });
Assert.Equal(result.Web, new[] { "1.1.2.1/24", "1.1.2.2/24" });
Assert.Equal(result.Api, new[] { "1.1.3.1/24", "1.1.3.2/24" });
Assert.Equal(result.Git, new[] { "1.1.4.1/24", "1.1.4.2/24" });
Assert.Equal(result.Packages, new[] { "1.1.5.1/24", "1.1.5.2/24" });
Assert.Equal(result.Pages, new[] { "1.1.6.1/24", "1.1.6.2/24" });
Assert.Equal(result.Importer, new[] { "1.1.7.1", "1.1.7.2" });
Assert.Equal(result.Actions, new[] { "1.1.8.1/24", "1.1.8.2/24" });
Assert.Equal(result.Dependabot, new[] { "1.1.9.1", "1.1.9.2" });

apiConnection.Received()
.Get<Meta>(Arg.Is<Uri>(u => u.ToString() == "meta"));
Expand Down

0 comments on commit a7ffa3f

Please sign in to comment.