Skip to content

Commit

Permalink
Added unit test for StringPrivateKeySource
Browse files Browse the repository at this point in the history
  • Loading branch information
adriangodong committed Aug 11, 2018
1 parent 7b727ec commit f1f59d4
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions GitHubJwt.Tests/GitHubJwtFactoryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,25 @@ public void CreateEncodedJwtToken_FromEnvVar_ShouldNotFail()
}
}

[TestMethod]
public void CreateEncodedJwtToken_FromString_ShouldNotFail()
{
// Arrange
var privateKeySource = new StringPrivateKeySource(File.ReadAllText("envvar.pem"));
var options = new GitHubJwtFactoryOptions
{
AppIntegrationId = 6837,
ExpirationSeconds = 600 // 10 minutes maximum
};
var factory = new GitHubJwtFactory(privateKeySource, options);

// Act
var token = factory.CreateEncodedJwtToken();

// Assert
Assert.IsNotNull(token);
Console.WriteLine(token);
}

}
}

0 comments on commit f1f59d4

Please sign in to comment.