Skip to content

Commit

Permalink
ci: fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
nattb8 committed Jun 26, 2023
1 parent 98a6a02 commit 45706fa
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 51 deletions.
23 changes: 12 additions & 11 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name: Lint Commit Messages
on: [ pull_request ]

jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v4
---
name: Lint Commit Messages
on: [pull_request]

jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v4
3 changes: 2 additions & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,5 @@ jobs:
VALIDATE_ALL_CODEBASE: true
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FILTER_REGEX_EXCLUDE: (.*src/Packages/Passport/Runtime/Assets/ThirdParty/.*|.*src/Packages/Passport/Runtime/Assets/Resources/Bundles/.*)
FILTER_REGEX_EXCLUDE: (.*src/Packages/Passport/Runtime/Assets/ThirdParty/.*|.*src/Packages/Passport/Runtime/Assets/Resources/Bundles/.*)
VALIDATE_GITLEAKS: false
3 changes: 1 addition & 2 deletions src/Packages/Passport/Runtime/Assets/Resources/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const clientId = "mjtCL8mt06BtbxSkp2vbrYStKWnXVZfo" // not required
const scope = "openid offline_access profile email transact"
const audience = "platform_api"
const redirectUri = "https://localhost:3000/" // Not required
Expand Down Expand Up @@ -30,7 +29,7 @@ const getPassportConfig = () => {
baseConfig: new config.ImmutableConfiguration({
environment: config.Environment.SANDBOX,
}),
clientId: clientId,
clientId: "NOT_REQUIRED",
...sharedConfigurationValues,
};
};
Expand Down
Original file line number Diff line number Di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GFwcC" +
"5jb20vdXNlcmluZm8iXSwiaWF0IjoxNjg2ODg5MDgwLCJleHAiOjE2ODY5NzU0ODAsImF6cCI6IlpKTDdKdmV0Y0RGQk5EbGdSczVvSm94dUFV" +
"VWw2dVFqIiwic2NvcGUiOiJvcGVuaWQgcHJvZmlsZSBlbWFpbCB0cmFuc2FjdCBvZmZsaW5lX2FjY2VzcyJ9.aqFem4Pp0k91YWdYuxBo1wfCr" +
"YAHy1Y1zIqof2GMQXd_mwhGBkHotUlgFAsOIQmvO6lQG5m3cHLR9zlEsFJ_2AJuJg3NTNnF0dEx12H5hx24_aN4qDga8Q9KNDdGc3x4LAxv48P" +
"H-P6OcdMnpWekCUPAI3zZ9qWC1YWU9HaouQuBJNbUV8ujyooFGOP4YzejQf2Uyxz9wmzDiMS-e70BSmY8IPRR2A3QjOEo7oI3enqM_jylfbDo8" +
"BsDRouDbwbZrMeX-rcJ_HBY5iZEdagVpcvOmfZCaad55MI_WJcXHrDMzmLqck1fd15Oklo7fajQtiG0ByINxTmm9_0YnEy02w";
internal const string REFRESH_TOKEN = "v1.NOQCr0kkmy0Cky_Doia8VgJdclSKOOOrkicjZ4NFeabS5J7xNct-oRwO2H65ua0mPOhzWfIf8lhxlM1sIUBqLoc";
internal const string ID_TOKEN = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9.eyJk" +
internal const string ID_TOKEN = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNhYVl5dGR3d2UwMzJzMXIzVElyOSJ9.eyJk" +
"ZXZlbG9wZXJfaHViIjp7ImFjdGl2YXRlZCI6dHJ1ZSwib3JnYW5pemF0aW9uIjp7ImlkIjoiYTU3YjFmM2QtZmE1Ny00Yjc4LTg2ZGMtOWQxMm" +
"QzNWI5YTY4In0sInJlc3BvbnNlSWQiOiI4MzhiangzOG1maG15cWs3bjgzOGJqeGZrMjdhZXQxMCI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mIiwidXNlcl9hZG" +
"1pbl9rZXkiOiIweGY4MjY4OTI0MWU3NTM1YjYyNTgyMmI4M2I1OWMxZDM3ZWUwOTBiZGMifSwibmlja25hbWUiOiJkb21pbmljLm11cnJheSIs" +
"Im5hbWUiOiJkb21pbmljLm11cnJheUBpbW11dGFibGUuY29tIiwicGljdHVyZSI6Imh0dHBzOi8vcy5ncmF2YXRhci5jb20vYXZhdGFyL2NkOT" +
Expand All @@ -58,26 +58,26 @@ public class AuthManagerTests
#pragma warning disable CS8618
private AuthManager manager;
private MockHttpMessageHandler httpMock;
private MockCredentialsManager credentialsManager;
private MockCredentialsManager credentialsManager;
#pragma warning restore CS8618

[SetUp]

[SetUp]
public void Init()
{
{
httpMock = new MockHttpMessageHandler();
credentialsManager = new MockCredentialsManager();
manager = new AuthManager(httpMock.ToHttpClient(), credentialsManager);
}

private async void PrepareForConfirmCode()
private async void PrepareForConfirmCode()
{
credentialsManager.hasValidCredentials = false;
credentialsManager.token = null;
AddDeviceCodeResponse();
_ = await manager.Login();
}

private void AddDeviceCodeResponse()
private void AddDeviceCodeResponse()
{
var deviceCodeResponse = new HttpResponseMessage(HttpStatusCode.OK)
{
Expand Down Expand Up @@ -136,8 +136,8 @@ public async Task Login_Success_UsingRefreshToken()
Assert.AreEqual(request.Method, HttpMethod.Post);
string stringContent = await request.Content.ReadAsStringAsync();
Assert.True(stringContent.Contains($"{KEY_REFRESH_TOKEN}={REFRESH_TOKEN}"));
}

}

[Test]
public async Task Login_Failed_GetDeviceCode()
{
Expand All @@ -146,11 +146,11 @@ public async Task Login_Failed_GetDeviceCode()
var deviceCodeResponse = new HttpResponseMessage(HttpStatusCode.NotAcceptable);
httpMock.Responses.Add(deviceCodeResponse);
Exception? e = null;
try
try
{
var result = await manager.Login();
}
catch (Exception exception)
}
catch (Exception exception)
{
e = exception;
}
Expand Down Expand Up @@ -230,11 +230,11 @@ public async Task ConfirmCode_Failed_PendingAndExpired()
Assert.Null(manager.GetUser());

Exception? e = null;
try
try
{
var result = await manager.ConfirmCode();
}
catch (Exception exception)
}
catch (Exception exception)
{
e = exception;
Debug.Log("Exception: " + e);
Expand Down Expand Up @@ -263,11 +263,11 @@ public async Task ConfirmCode_Failed_SlowDownAndAccessDenied()
Assert.Null(manager.GetUser());

Exception? e = null;
try
try
{
var result = await manager.ConfirmCode();
}
catch (Exception exception)
}
catch (Exception exception)
{
e = exception;
Debug.Log("Exception: " + e);
Expand All @@ -290,11 +290,11 @@ public async Task ConfirmCode_Failed_UnexpectedErrorCode()
Assert.Null(manager.GetUser());

Exception? e = null;
try
try
{
var result = await manager.ConfirmCode();
}
catch (Exception exception)
}
catch (Exception exception)
{
e = exception;
Debug.Log("Exception: " + e);
Expand All @@ -316,11 +316,11 @@ public async Task ConfirmCode_Failed_UnexpectedResponse()
Assert.Null(manager.GetUser());

Exception? e = null;
try
try
{
var result = await manager.ConfirmCode();
}
catch (Exception exception)
}
catch (Exception exception)
{
e = exception;
Debug.Log("Exception: " + e);
Expand All @@ -334,7 +334,7 @@ public void HasCredentialsSavedTest()
{
Assert.False(manager.HasCredentialsSaved());

credentialsManager.token = new TokenResponse()
credentialsManager.token = new TokenResponse()
{
access_token = AuthManagerTests.ACCESS_TOKEN,
refresh_token = AuthManagerTests.REFRESH_TOKEN,
Expand All @@ -351,27 +351,27 @@ private string CreateErrorJsonString(string error)
}
}

internal class MockCredentialsManager : ICredentialsManager
internal class MockCredentialsManager : ICredentialsManager
{
public bool hasValidCredentials = false;
public TokenResponse? token = null;

public void SaveCredentials(TokenResponse tokenResponse)
public void SaveCredentials(TokenResponse tokenResponse)
{
token = tokenResponse;
}

public TokenResponse? GetCredentials()
public TokenResponse? GetCredentials()
{
return token;
}

public bool HasValidCredentials()
public bool HasValidCredentials()
{
return hasValidCredentials;
}

public void ClearCredentials()
public void ClearCredentials()
{

}
Expand Down

0 comments on commit 45706fa

Please sign in to comment.