Skip to content

Commit dce27a9

Browse files
committed
fix more tests
1 parent dbc0119 commit dce27a9

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

plugins/core/jetbrains-community/tst/software/aws/toolkits/jetbrains/core/credentials/sso/SsoAccessTokenProviderTest.kt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class SsoAccessTokenProviderTest {
124124
verify(ssoOidcClient).startDeviceAuthorization(any<StartDeviceAuthorizationRequest>())
125125
verify(ssoOidcClient).createToken(any<CreateTokenRequest>())
126126
verify(ssoCache).loadAccessToken(argThat<DeviceGrantAccessTokenCacheKey> { startUrl == ssoUrl })
127-
verify(ssoCache).loadClientRegistration(argThat { region == ssoRegion })
127+
verify(ssoCache).loadClientRegistration(argThat { region == ssoRegion }, any<String>())
128128
verify(ssoCache).saveAccessToken(argThat<DeviceGrantAccessTokenCacheKey> { startUrl == ssoUrl }, eq(accessToken))
129129
}
130130

@@ -170,7 +170,7 @@ class SsoAccessTokenProviderTest {
170170
verify(ssoOidcClient).startDeviceAuthorization(any<StartDeviceAuthorizationRequest>())
171171
verify(ssoOidcClient).createToken(any<CreateTokenRequest>())
172172
verify(ssoCache).loadAccessToken(argThat<DeviceGrantAccessTokenCacheKey> { startUrl == ssoUrl })
173-
verify(ssoCache).loadClientRegistration(argThat<DeviceAuthorizationClientRegistrationCacheKey> { region == ssoRegion })
173+
verify(ssoCache).loadClientRegistration(argThat<DeviceAuthorizationClientRegistrationCacheKey> { region == ssoRegion }, any<String>())
174174
verify(ssoCache).saveClientRegistration(argThat<DeviceAuthorizationClientRegistrationCacheKey> { region == ssoRegion }, any())
175175
verify(ssoCache).saveAccessToken(argThat<DeviceGrantAccessTokenCacheKey> { startUrl == ssoUrl }, eq(accessToken))
176176
}
@@ -267,7 +267,7 @@ class SsoAccessTokenProviderTest {
267267
verify(ssoOidcClient).startDeviceAuthorization(any<StartDeviceAuthorizationRequest>())
268268
verify(ssoOidcClient, times(2)).createToken(any<CreateTokenRequest>())
269269
verify(ssoCache).loadAccessToken(argThat<DeviceGrantAccessTokenCacheKey> { startUrl == ssoUrl })
270-
verify(ssoCache).loadClientRegistration(argThat<DeviceAuthorizationClientRegistrationCacheKey> { region == ssoRegion })
270+
verify(ssoCache).loadClientRegistration(argThat<DeviceAuthorizationClientRegistrationCacheKey> { region == ssoRegion }, any<String>())
271271
verify(ssoCache).saveAccessToken(argThat<DeviceGrantAccessTokenCacheKey> { startUrl == ssoUrl }, eq(accessToken))
272272
}
273273

@@ -296,7 +296,7 @@ class SsoAccessTokenProviderTest {
296296
val refreshedToken = runBlocking { sut.refreshToken(sut.accessToken()) }
297297

298298
verify(ssoCache).loadAccessToken(argThat<DeviceGrantAccessTokenCacheKey> { startUrl == ssoUrl })
299-
verify(ssoCache).loadClientRegistration(argThat { region == ssoRegion })
299+
verify(ssoCache).loadClientRegistration(argThat { region == ssoRegion }, any<String>())
300300
verify(ssoOidcClient).createToken(any<CreateTokenRequest>())
301301
verify(ssoCache).saveAccessToken(argThat<DeviceGrantAccessTokenCacheKey> { startUrl == ssoUrl }, eq(refreshedToken))
302302
}
@@ -342,7 +342,7 @@ class SsoAccessTokenProviderTest {
342342
)
343343

344344
on(
345-
ssoCache.loadClientRegistration(any<PKCEClientRegistrationCacheKey>())
345+
ssoCache.loadClientRegistration(any<PKCEClientRegistrationCacheKey>(), any<String>())
346346
).thenReturn(
347347
PKCEClientRegistration(
348348
clientType = "public",
@@ -369,7 +369,7 @@ class SsoAccessTokenProviderTest {
369369
val refreshedToken = runBlocking { sut.refreshToken(sut.accessToken()) }
370370

371371
verify(ssoCache).loadAccessToken(any<PKCEAccessTokenCacheKey>())
372-
verify(ssoCache).loadClientRegistration(any<PKCEClientRegistrationCacheKey>())
372+
verify(ssoCache).loadClientRegistration(any<PKCEClientRegistrationCacheKey>(), any<String>())
373373
verify(ssoOidcClient).createToken(any<CreateTokenRequest>())
374374
verify(ssoCache).saveAccessToken(any<PKCEAccessTokenCacheKey>(), eq(refreshedToken))
375375
}
@@ -390,7 +390,7 @@ class SsoAccessTokenProviderTest {
390390
verify(ssoOidcClient).startDeviceAuthorization(any<StartDeviceAuthorizationRequest>())
391391
verify(ssoOidcClient).createToken(any<CreateTokenRequest>())
392392
verify(ssoCache).loadAccessToken(argThat<DeviceGrantAccessTokenCacheKey> { startUrl == ssoUrl })
393-
verify(ssoCache).loadClientRegistration(argThat<DeviceAuthorizationClientRegistrationCacheKey> { region == ssoRegion })
393+
verify(ssoCache).loadClientRegistration(argThat<DeviceAuthorizationClientRegistrationCacheKey> { region == ssoRegion }, any<String>())
394394
}
395395

396396
@Test
@@ -432,7 +432,7 @@ class SsoAccessTokenProviderTest {
432432
verify(ssoOidcClient).startDeviceAuthorization(any<StartDeviceAuthorizationRequest>())
433433
verify(ssoOidcClient, times(2)).createToken(any<CreateTokenRequest>())
434434
verify(ssoCache).loadAccessToken(argThat<DeviceGrantAccessTokenCacheKey> { startUrl == ssoUrl })
435-
verify(ssoCache).loadClientRegistration(argThat<DeviceAuthorizationClientRegistrationCacheKey> { region == ssoRegion })
435+
verify(ssoCache).loadClientRegistration(argThat<DeviceAuthorizationClientRegistrationCacheKey> { region == ssoRegion }, any<String>())
436436
verify(ssoCache).saveAccessToken(argThat<DeviceGrantAccessTokenCacheKey> { startUrl == ssoUrl }, eq(accessToken))
437437
}
438438

@@ -452,7 +452,7 @@ class SsoAccessTokenProviderTest {
452452

453453
verify(ssoOidcClient).registerClient(any<RegisterClientRequest>())
454454
verify(ssoCache).loadAccessToken(any())
455-
verify(ssoCache).loadClientRegistration(argThat { region == ssoRegion })
455+
verify(ssoCache).loadClientRegistration(argThat { region == ssoRegion }, any<String>())
456456
}
457457

458458
@Test
@@ -492,7 +492,7 @@ class SsoAccessTokenProviderTest {
492492
)
493493

494494
on(
495-
ssoCache.loadClientRegistration(argThat { region == ssoRegion })
495+
ssoCache.loadClientRegistration(argThat { region == ssoRegion }, any<String>())
496496
).thenReturn(
497497
returnValue
498498
)

plugins/core/jetbrains-community/tst/software/aws/toolkits/jetbrains/core/credentials/sso/bearer/InteractiveBearerTokenProviderTest.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import org.junit.jupiter.api.assertThrows
1616
import org.mockito.Mockito
1717
import org.mockito.kotlin.any
1818
import org.mockito.kotlin.argThat
19+
import org.mockito.kotlin.eq
1920
import org.mockito.kotlin.mock
2021
import org.mockito.kotlin.spy
2122
import org.mockito.kotlin.times
@@ -273,7 +274,7 @@ class InteractiveBearerTokenProviderTest {
273274
)
274275

275276
private fun stubClientRegistration() {
276-
whenever(diskCache.loadClientRegistration(any<DeviceAuthorizationClientRegistrationCacheKey>())).thenReturn(
277+
whenever(diskCache.loadClientRegistration(any<DeviceAuthorizationClientRegistrationCacheKey>(), eq("testSource"))).thenReturn(
277278
DeviceAuthorizationClientRegistration(
278279
"",
279280
"",

0 commit comments

Comments
 (0)