@@ -22,9 +22,9 @@ import okhttp3.mockwebserver.MockResponse
2222import okhttp3.mockwebserver.RecordedRequest
2323import org.apache.commons.codec.binary.ZBase32
2424import org.apache.commons.codec.digest.DigestUtils
25+ import org.junit.Assert.assertNull
2526import org.junit.Assert.assertTrue
2627import org.junit.ClassRule
27- import org.junit.Ignore
2828import org.junit.Rule
2929import org.junit.Test
3030import org.junit.rules.RuleChain
@@ -35,10 +35,6 @@ import java.net.HttpURLConnection
3535
3636@SmallTest
3737@RunWith(AndroidJUnit4 ::class )
38- @Ignore(
39- " Need to think about this test. " +
40- " It uses real API calls and sometimes it fails due to a server not available issue."
41- )
4238class WkdClientTest {
4339 private val context: Context = ApplicationProvider .getApplicationContext()
4440
@@ -48,22 +44,21 @@ class WkdClientTest {
4844 .around(GrantPermissionRuleChooser .grant(android.Manifest .permission.POST_NOTIFICATIONS ))
4945
5046 @Test
51- fun existingEmailTest () = runBlocking {
47+ fun existingEmailFlowCryptDomainTest () = runBlocking {
5248 val keys = WkdClient .lookupEmail(context, EXISTING_EMAIL )
53- assertTrue(" Key not found" , keys != null )
54- assertTrue(" There are no keys in the key collection" , keys!! .keyRings.hasNext())
49+ assertTrue(" There are no keys in the key collection" , requireNotNull(keys).keyRings.hasNext())
5550 }
5651
5752 @Test
58- fun nonExistingEmailTest1 () = runBlocking {
53+ fun nonExistingEmailFlowCryptDomainTest () = runBlocking {
5954 val keys = WkdClient .lookupEmail(context, NOT_EXISTING_EMAIL )
60- assertTrue (" Key found for non-existing email" , keys == null )
55+ assertNull (" Key found for non-existing email" , keys)
6156 }
6257
6358 @Test
64- fun nonExistingEmailTest2 () = runBlocking {
65- val keys = WkdClient .lookupEmail(context, " doesnotexist@google.com " )
66- assertTrue (" Key found for non-existing email" , keys == null )
59+ fun nonExistingEmailForKnownDomainTest () = runBlocking {
60+ val keys = WkdClient .lookupEmail(context, " doesnotexist@localhost " )
61+ assertNull (" Key found for non-existing email" , keys)
6762 }
6863
6964 @Test
@@ -72,7 +67,7 @@ class WkdClientTest {
7267 context,
7368 " doesnotexist@thisdomaindoesnotexist.example"
7469 )
75- assertTrue (" Key found for non-existing email " , keys == null )
70+ assertNull (" Key found for non-existing domain " , keys)
7671 }
7772
7873 companion object {
0 commit comments