Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Enhance unit-test to check for key revokation return value (DEV) #1580

Merged
merged 2 commits into from
Nov 12, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class BaseKeyPackageSyncToolTest : BaseIOTest() {
)

@Test
fun `key invalidation based on ETags`() = runBlockingTest {
fun `revoke keys based on ETags and return true if something happened`() = runBlockingTest {
val invalidatedDay = mockk<KeyDownloadConfig.RevokedKeyPackage>().apply {
every { etag } returns "etag-badday"
}
Expand Down Expand Up @@ -106,7 +106,12 @@ class BaseKeyPackageSyncToolTest : BaseIOTest() {
coEvery { keyCache.getAllCachedKeys() } returns listOf(badDay, goodDay, badHour, goodHour)

val instance = createInstance()
instance.revokeCachedKeys(listOf(invalidatedDay, invalidatedHour))
instance.revokeCachedKeys(listOf(invalidatedDay, invalidatedHour)) shouldBe true

coEvery { keyCache.getAllCachedKeys() } returns emptyList()
instance.revokeCachedKeys(listOf(invalidatedDay, invalidatedHour)) shouldBe false

instance.revokeCachedKeys(emptyList()) shouldBe false

coVerify { keyCache.delete(listOf(badDayInfo, badHourInfo)) }
}
Expand Down