Skip to content

Commit

Permalink
v1.5.2 extension.yaml update
Browse files Browse the repository at this point in the history
  • Loading branch information
SparrowBrain committed Oct 4, 2024
1 parent e946b6a commit cfd8762
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 29 deletions.
2 changes: 1 addition & 1 deletion PlayNext/extension.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Id: SparrowBrain_PlayNext
Name: Play Next
Author: SparrowBrain
Version: 1.5.1
Version: 1.5.2
Module: PlayNext.dll
Type: GenericPlugin
Icon: icon.png
Expand Down
46 changes: 23 additions & 23 deletions ReleaseTools.UnitTests/GitHubTools/AuthStatusParserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,32 @@

namespace ReleaseTools.UnitTests.GitHubTools
{
public class AuthStatusParserTests
{
[Theory, AutoData]
public void IsUserLoggedIn_ReturnsTrue_When_UserIsLoggedIn(AuthStatusParser sut)
{
// Arrange
var output = "\u001b[0;1;39mgithub.com\u001b[0m\r\n \u001b[0;32mŌ£ō\u001b[0m Logged in to github.com as \u001b[0;1;39mSparrowBrain\u001b[0m (keyring)\r\n \u001b[0;32mŌ£ō\u001b[0m Git operations for github.com configured to use \u001b[0;1;39mhttps\u001b[0m protocol.\r\n \u001b[0;32mŌ£ō\u001b[0m Token: gho_************************************\r\n \u001b[0;32mŌ£ō\u001b[0m Token scopes: gist, read:org, repo\r\n\r\n";
public class AuthStatusParserTests
{
[Theory, AutoData]
public void IsUserLoggedIn_ReturnsTrue_When_UserIsLoggedIn(AuthStatusParser sut)
{
// Arrange
var output = "\u001b[0;1;39mgithub.com\u001b[0m\r\n \u001b[0;32mŌ£ō\u001b[0m Logged in to github.com account \u001b[0;1;39mSparrowBrain\u001b[0m (keyring)\r\n \u001b[0;32mŌ£ō\u001b[0m Git operations for github.com configured to use \u001b[0;1;39mhttps\u001b[0m protocol.\r\n \u001b[0;32mŌ£ō\u001b[0m Token: gho_************************************\r\n \u001b[0;32mŌ£ō\u001b[0m Token scopes: gist, read:org, repo\r\n\r\n";

// Act
var result = sut.IsUserLoggedIn(output);
// Act
var result = sut.IsUserLoggedIn(output);

// Assert
Assert.True(result);
}
// Assert
Assert.True(result);
}

[Theory, AutoData]
public void IsUserLoggedIn_ReturnsFalse_When_UserIsLoggedOut(AuthStatusParser sut)
{
// Arrange
var output = "You are not logged into any GitHub hosts. Run \u001b[0;1;39mgh auth login\u001b[0m to authenticate.\r\n\r\n";
[Theory, AutoData]
public void IsUserLoggedIn_ReturnsFalse_When_UserIsLoggedOut(AuthStatusParser sut)
{
// Arrange
var output = "You are not logged into any GitHub hosts. Run \u001b[0;1;39mgh auth login\u001b[0m to authenticate.\r\n\r\n";

// Act
var result = sut.IsUserLoggedIn(output);
// Act
var result = sut.IsUserLoggedIn(output);

// Assert
Assert.False(result);
}
}
// Assert
Assert.False(result);
}
}
}
2 changes: 1 addition & 1 deletion ReleaseTools/GitHubTools/AuthStatusParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ public class AuthStatusParser
{
public bool IsUserLoggedIn(string output)
{
return output.Contains("Logged in to github.com as");
return output.Contains("Logged in to github.com account");
}
}
}
9 changes: 5 additions & 4 deletions ReleaseTools/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ private static async Task Main(string[] args)
var pathToSolution = "..";

var msBuild = @"""C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe""";
var testRunner = @"""C:\Users\Qwx\Documents\src\Playnite.PlayNext\packages\xunit.runner.console.2.4.2\tools\net462\xunit.console.exe""";
var testRunner = $@"""{pathToSolution}\packages\xunit.runner.console.2.4.2\tools\net462\xunit.console.exe""";
var toolbox = @"""C:\Users\Qwx\AppData\Local\Playnite\Toolbox.exe""";

await EnsureGitHubAuthentication();
Expand Down Expand Up @@ -55,11 +55,12 @@ private static async Task EnsureGitHubAuthentication()
var p = new Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.FileName = "gh";
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = "gh";
p.StartInfo.Arguments = "auth status";
p.Start();
var output = await p.StandardError.ReadToEndAsync();
p.WaitForExit();
var output = await p.StandardOutput.ReadToEndAsync();
p.WaitForExit();

if (!authStatusParser.IsUserLoggedIn(output))
{
Expand Down

0 comments on commit cfd8762

Please sign in to comment.