mirror of
https://github.com/DrMboga/WotBlitzStatisticsBlazor.git
synced 2026-10-24 11:50:05 +02:00
feat: implemented login-prolong-logout mechanisms
This commit is contained in:
1 parent
79a87d0d66
commit
241b879689
53 files changed
+1789
-13
No files matched your search
@@ -20,6 +20,11 @@ namespace WotBlitzStatisticsPro.Blazor.Tests.Services
|
||||
private Mock<IFindPlayersQuery> _findPlayersQueryMock;
|
||||
private Mock<IPlayerQuery> _playerQueryMock;
|
||||
private Mock<IUpdatePlayerMutation> _updatePlayerMutationMock;
|
||||
private Mock<IWargamingAuthenticationQueryQuery> _wargamingAuthenticationQueryMock;
|
||||
private Mock<IWargamingOpenIdMutation> _wagamingOpenIdMutation;
|
||||
private Mock<IWargamingOpenIdAuthenticationMutation> _wargamingOpenIdAuthenticationMutationMock;
|
||||
private Mock<IWargamingPlayersMutation> _wargamingPlayersMutation;
|
||||
|
||||
private WotBlitzStatisticsProClient _generatedClient;
|
||||
private Mock<INotificationsService> _notificationServiceMock;
|
||||
private GraphQlBackendService _service;
|
||||
@@ -48,13 +53,25 @@ namespace WotBlitzStatisticsPro.Blazor.Tests.Services
|
||||
_findPlayersQueryMock = new();
|
||||
_playerQueryMock = new();
|
||||
_updatePlayerMutationMock = new();
|
||||
_wargamingAuthenticationQueryMock = new();
|
||||
_wagamingOpenIdMutation = new();
|
||||
_wargamingOpenIdAuthenticationMutationMock = new();
|
||||
_wargamingPlayersMutation = new();
|
||||
|
||||
await SetUpFindClans();
|
||||
await SetUpFindPlayers();
|
||||
await SetUpGetPlayer();
|
||||
|
||||
_generatedClient =
|
||||
new WotBlitzStatisticsProClient(_findClanQueryMock.Object, _findPlayersQueryMock.Object, _playerQueryMock.Object, _updatePlayerMutationMock.Object);
|
||||
new WotBlitzStatisticsProClient(
|
||||
_findClanQueryMock.Object,
|
||||
_findPlayersQueryMock.Object,
|
||||
_wargamingAuthenticationQueryMock.Object,
|
||||
_wagamingOpenIdMutation.Object,
|
||||
_playerQueryMock.Object,
|
||||
_wargamingOpenIdAuthenticationMutationMock.Object,
|
||||
_wargamingPlayersMutation.Object,
|
||||
_updatePlayerMutationMock.Object);
|
||||
|
||||
_notificationServiceMock = new();
|
||||
|
||||
|
||||
@@ -109,13 +109,13 @@ namespace WotBlitzStatisticsPro.Blazor.Tests.Services
|
||||
|
||||
_localStorageMock.Setup(s => s.GetItemAsync<LoginInfo>(Constants.LoginInfoLocalStorageKey))
|
||||
.ReturnsAsync(new LoginInfo { AccountId = accountId, AccessToken = oldToken, ExpiresAt = 12345678, Realm = realm });
|
||||
_graphQlBackendMock.Setup(s => s.ProlongToken(accountId, oldToken, realm)).ReturnsAsync(new LoginInfo { AccountId = accountId, AccessToken = newToken, ExpiresAt = newEvpiration, Realm = realm });
|
||||
_graphQlBackendMock.Setup(s => s.ProlongToken(oldToken, realm)).ReturnsAsync(new LoginInfo { AccountId = accountId, AccessToken = newToken, ExpiresAt = newEvpiration, Realm = realm });
|
||||
|
||||
// Avtion
|
||||
await _service.Handle(new ProlongWargamingAccessToken(), CancellationToken.None);
|
||||
|
||||
// Assert
|
||||
_graphQlBackendMock.Verify(s => s.ProlongToken(accountId, oldToken, realm), Times.Once);
|
||||
_graphQlBackendMock.Verify(s => s.ProlongToken(oldToken, realm), Times.Once);
|
||||
_localStorageMock.Verify(s => s.SetItemAsync<LoginInfo>(
|
||||
Constants.LoginInfoLocalStorageKey,
|
||||
It.Is<LoginInfo>(l => l.Realm == realm && l.AccountId == accountId && l.AccessToken == newToken && l.ExpiresAt == newEvpiration))
|
||||
|
||||
Reference in new issue
Block a user