-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restored WkdClientTest with a few changes.| #1201
- Loading branch information
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
FlowCrypt/src/test/java/com/flowcrypt/email/api/email/WkdClientTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* © 2016-present FlowCrypt a.s. Limitations apply. Contact [email protected] | ||
* Contributors: | ||
* Ivan Pizhenko | ||
* DenBond7 | ||
*/ | ||
|
||
package com.flowcrypt.email.api.email | ||
|
||
import com.flowcrypt.email.api.wkd.WkdClient | ||
import kotlinx.coroutines.runBlocking | ||
import org.junit.Assert.assertTrue | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import org.robolectric.RobolectricTestRunner | ||
import org.robolectric.RuntimeEnvironment | ||
|
||
@RunWith(RobolectricTestRunner::class) | ||
class WkdClientTest { | ||
@Test | ||
fun existingEmailTest() = runBlocking { | ||
val keys = | ||
WkdClient.lookupEmail(RuntimeEnvironment.getApplication(), "[email protected]") | ||
assertTrue("Key not found", keys != null) | ||
assertTrue("There are no keys in the key collection", keys!!.keyRings.hasNext()) | ||
} | ||
|
||
@Test | ||
fun nonExistingEmailTest1() = runBlocking { | ||
val keys = WkdClient.lookupEmail( | ||
RuntimeEnvironment.getApplication(), | ||
"[email protected]" | ||
) | ||
assertTrue("Key found for non-existing email", keys == null) | ||
} | ||
|
||
@Test | ||
fun nonExistingEmailTest2() = runBlocking { | ||
val keys = WkdClient.lookupEmail(RuntimeEnvironment.getApplication(), "[email protected]") | ||
assertTrue("Key found for non-existing email", keys == null) | ||
} | ||
|
||
@Test | ||
fun nonExistingDomainTest() = runBlocking { | ||
val keys = WkdClient.lookupEmail( | ||
RuntimeEnvironment.getApplication(), | ||
"[email protected]" | ||
) | ||
assertTrue("Key found for non-existing email", keys == null) | ||
} | ||
} | ||
|