Skip to content

Commit dafd506

Browse files
committed
diskCacheTests
1 parent 9686ab5 commit dafd506

File tree

1 file changed

+28
-0
lines changed
  • plugins/core/jetbrains-community/tst/software/aws/toolkits/jetbrains/core/credentials/sso

1 file changed

+28
-0
lines changed

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import com.intellij.openapi.util.SystemInfo
77
import com.intellij.openapi.util.io.NioFiles
88
import com.intellij.testFramework.ApplicationExtension
99
import org.assertj.core.api.Assertions.assertThat
10+
import org.assertj.core.api.Assertions.assertThatThrownBy
1011
import org.junit.jupiter.api.BeforeEach
1112
import org.junit.jupiter.api.Test
1213
import org.junit.jupiter.api.condition.DisabledOnOs
@@ -714,4 +715,31 @@ class DiskCacheTest {
714715
.usingRecursiveComparison()
715716
.isEqualTo(sut.loadAccessToken(key2))
716717
}
718+
719+
@Test
720+
fun `loadClientRegistration returns null when file not found during registration`() {
721+
val key = DeviceAuthorizationClientRegistrationCacheKey(
722+
startUrl = ssoUrl,
723+
scopes = scopes,
724+
region = ssoRegion
725+
)
726+
727+
assertThat(sut.loadClientRegistration(key, SsoAccessTokenProvider.SourceOfLoadRegistration.REGISTER_CLIENT.toString())).isNull()
728+
}
729+
730+
@Test
731+
fun `loadClientRegistration throws exception when file not found during refresh`() {
732+
val key = DeviceAuthorizationClientRegistrationCacheKey(
733+
startUrl = ssoUrl,
734+
scopes = scopes,
735+
region = ssoRegion
736+
)
737+
738+
assertThatThrownBy {
739+
sut.loadClientRegistration(
740+
key,
741+
SsoAccessTokenProvider.SourceOfLoadRegistration.REFRESH_TOKEN.toString()
742+
)
743+
}.isInstanceOf(ClientRegistrationNotFoundException::class.java)
744+
}
717745
}

0 commit comments

Comments
 (0)