Skip to content
This repository was archived by the owner on Dec 3, 2019. It is now read-only.

Commit 30daf5f

Browse files
Merge pull request #137 from justaprogrammer/fixes-again
Fixes again
2 parents 4743c5d + efdcc70 commit 30daf5f

16 files changed

+3
-153
lines changed

src/BCC.Web.IntegrationTests/IntegrationTestsBase.cs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -38,37 +38,16 @@ protected IGitHubClient CreateGitHubAppClient()
3838
return gitHubClientFactory.CreateAppClient(tokenGenerator);
3939
}
4040

41-
protected IGitHubGraphQLClient CreateGitHubAppGraphQLClient()
42-
{
43-
var gitHubClientFactory = CreateGitHubAppClientFactory();
44-
var tokenGenerator = CreateTokenGenerator();
45-
return gitHubClientFactory.CreateAppGraphQLClient(tokenGenerator);
46-
}
47-
4841
protected async Task<IGitHubClient> CreateGitHubAppClientForLogin(string login)
4942
{
5043
var gitHubClientFactory = CreateGitHubAppClientFactory();
5144
var tokenGenerator = CreateTokenGenerator();
5245
return await gitHubClientFactory.CreateAppClientForLoginAsync(tokenGenerator, login);
5346
}
54-
55-
protected async Task<IGitHubGraphQLClient> CreateGitHubAppGraphQLClientForLogin(string login)
56-
{
57-
var gitHubClientFactory = CreateGitHubAppClientFactory();
58-
var tokenGenerator = CreateTokenGenerator();
59-
return await gitHubClientFactory.CreateAppGraphQLClientForLoginAsync(tokenGenerator, login);
60-
}
61-
6247
protected IGitHubClient CreateGitHubTokenClient()
6348
{
6449
var gitHubClientFactory = new GitHubClientFactory();
6550
return gitHubClientFactory.CreateClient(TestToken);
6651
}
67-
68-
protected IGitHubGraphQLClient CreateGitHubGraphQLTokenClient()
69-
{
70-
var gitHubClientFactory = new GitHubClientFactory();
71-
return gitHubClientFactory.CreateGraphQLClient(TestToken);
72-
}
7352
}
7453
}

src/BCC.Web.IntegrationTests/Services/GitHubAppModelServiceBaseTests.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,15 @@ public async Task ShouldNotGetFileThatDoesNotExist()
2727

2828
private TestAppModelService CreateTarget()
2929
{
30-
return new TestAppModelService(CreateGitHubTokenClient(), CreateGitHubGraphQLTokenClient());
30+
return new TestAppModelService(CreateGitHubTokenClient());
3131
}
3232

3333
private class TestAppModelService : GitHubAppModelServiceBase
3434
{
3535
private readonly IGitHubClient _gitHubClient;
36-
private readonly IGitHubGraphQLClient _graphQLClient;
3736

38-
public TestAppModelService(IGitHubClient gitHubClient, IGitHubGraphQLClient graphQLClient)
37+
public TestAppModelService(IGitHubClient gitHubClient)
3938
{
40-
_graphQLClient = graphQLClient;
4139
_gitHubClient = gitHubClient;
4240
}
4341

src/BCC.Web.IntegrationTests/Services/GitHubGraphQLClientIntegrationTests.cs

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/BCC.Web.Tests/Services/AccessTokenServiceTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public async Task CreateValidTokenTest()
143143
jsonWebToken.GetPayloadValue<string>(JwtRegisteredClaimNames.Aud).Should().Be(".Api");
144144
jsonWebToken.GetPayloadValue<string>(JwtRegisteredClaimNames.Jti).Should().Be(accessToken.Id.ToString());
145145
DateTimeOffset.FromUnixTimeSeconds(jsonWebToken.GetPayloadValue<int>(JwtRegisteredClaimNames.Iat)).Should()
146-
.BeCloseTo(DateTimeOffset.UtcNow, 1000);
146+
.BeCloseTo(DateTimeOffset.UtcNow, 2000);
147147
jsonWebToken.GetPayloadValue<long>("urn:bcc:repositoryId").Should().Be(userRepository.Id);
148148
}
149149

src/BCC.Web/BCC.Web.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
<PackageReference Include="morelinq" Version="3.0.0" />
2727
<PackageReference Include="Nito.AsyncEx" Version="5.0.0-pre-05" />
2828
<PackageReference Include="Octokit" Version="0.32.0" />
29-
<PackageReference Include="Octokit.GraphQL" Version="0.1.2-beta" />
3029
<PackageReference Include="Swashbuckle.AspNetCore" Version="3.0.0" />
3130
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="3.0.0" />
3231
<PackageReference Include="System.IO.Abstractions" Version="2.1.0.256" />

src/BCC.Web/Interfaces/GitHub/IGitHubAppClientFactory.cs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,11 @@ public interface IGitHubAppClientFactory
1616
/// <returns>A client</returns>
1717
Task<IGitHubClient> CreateAppClientForLoginAsync(ITokenGenerator tokenGenerator, string login);
1818

19-
/// <summary>
20-
/// Create a IGitHubGraphQLClient configured for GitHub App Installation Authentication.
21-
/// </summary>
22-
/// <param name="tokenGenerator">A token generator configured for the GitHub App.</param>
23-
/// <param name="login">The login to authenticate.</param>
24-
/// <returns>A graphql client</returns>
25-
Task<IGitHubGraphQLClient> CreateAppGraphQLClientForLoginAsync(ITokenGenerator tokenGenerator, string login);
26-
2719
/// <summary>
2820
/// Create a IGitHubClient configured for GitHub App Authentication.
2921
/// </summary>
3022
/// <param name="tokenGenerator">A token generator configured for the GitHub App.</param>
3123
/// <returns>A client</returns>
3224
IGitHubClient CreateAppClient(ITokenGenerator tokenGenerator);
33-
34-
/// <summary>
35-
/// Create a IGitHubGraphQLClient configured for GitHub App Authentication.
36-
/// </summary>
37-
/// <param name="tokenGenerator">A token generator configured for the GitHub App.</param>
38-
/// <returns>A graphql client</returns>
39-
IGitHubGraphQLClient CreateAppGraphQLClient(ITokenGenerator tokenGenerator);
4025
}
4126
}

src/BCC.Web/Interfaces/GitHub/IGitHubClientFactory.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,5 @@ public interface IGitHubClientFactory
1313
/// <param name="token">The token.</param>
1414
/// <returns>A client</returns>
1515
IGitHubClient CreateClient(string token);
16-
17-
/// <summary>
18-
/// Create a IGitHubGraphQLClient configured with a token for Authentication.
19-
/// </summary>
20-
/// <param name="token">The token.</param>
21-
/// <returns>A graphql client</returns>
22-
IGitHubGraphQLClient CreateGraphQLClient(string token);
2316
}
2417
}

src/BCC.Web/Interfaces/GitHub/IGitHubGraphQLClient.cs

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/BCC.Web/Interfaces/GitHub/IGitHubUserClientFactory.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,5 @@ public interface IGitHubUserClientFactory
1313
/// </summary>
1414
/// <returns>A client</returns>
1515
Task<IGitHubClient> CreateClient();
16-
17-
/// <summary>
18-
/// Create a IGitHubGraphQLClient configured for GitHub App User-To-Server Authentication.
19-
/// </summary>
20-
/// <returns>A graphql client</returns>
21-
Task<IGitHubGraphQLClient> CreateGraphQLClient();
2216
}
2317
}

src/BCC.Web/Services/GitHub/GitHubAppClientFactory.cs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using System.Threading.Tasks;
44
using Octokit;
55
using IGitHubAppClientFactory = BCC.Web.Interfaces.GitHub.IGitHubAppClientFactory;
6-
using IGitHubGraphQLClient = BCC.Web.Interfaces.GitHub.IGitHubGraphQLClient;
76
using ITokenGenerator = BCC.Web.Interfaces.GitHub.ITokenGenerator;
87

98
namespace BCC.Web.Services.GitHub
@@ -29,20 +28,6 @@ public IGitHubClient CreateAppClient(ITokenGenerator tokenGenerator)
2928
};
3029
}
3130

32-
/// <inheritdoc />
33-
public IGitHubGraphQLClient CreateAppGraphQLClient(ITokenGenerator tokenGenerator)
34-
{
35-
var token = tokenGenerator.GetToken();
36-
return GitHubClientFactoryHelper.GraphQLClient(token, GitHubClientFactory.UserAgent);
37-
}
38-
39-
/// <inheritdoc />
40-
public async Task<IGitHubGraphQLClient> CreateAppGraphQLClientForLoginAsync(ITokenGenerator tokenGenerator, string login)
41-
{
42-
var (installation, token) = await FindInstallationAndGetToken(tokenGenerator, login);
43-
return GitHubClientFactoryHelper.GraphQLClient(token, GetUserAgent(installation));
44-
}
45-
4631
private async Task<ValueTuple<Installation, string>> FindInstallationAndGetToken(ITokenGenerator tokenGenerator, string login)
4732
{
4833
var appClient = CreateAppClient(tokenGenerator);

0 commit comments

Comments
 (0)