From 00cb60461ab8edd024770090c47bb2adf9ca160b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 27 Apr 2025 20:23:23 +0000 Subject: [PATCH 1/2] Bump com.android.application from 8.9.1 to 8.9.2 Bumps com.android.application from 8.9.1 to 8.9.2. --- updated-dependencies: - dependency-name: com.android.application dependency-version: 8.9.2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 6f960cc898..1e61a1de1c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,7 +6,7 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. plugins { - id("com.android.application") version "8.9.1" apply false + id("com.android.application") version "8.9.2" apply false id("org.jetbrains.kotlin.android") version "2.1.20" apply false id("androidx.navigation.safeargs.kotlin") version "2.8.9" apply false id("com.starter.easylauncher") version "6.4.0" apply false From 1021fb7891bf42b03204a64f41aadd4969672121 Mon Sep 17 00:00:00 2001 From: denbond7 Date: Tue, 6 May 2025 14:36:48 +0300 Subject: [PATCH 2/2] wip --- .../java/com/flowcrypt/email/WkdClientTest.kt | 73 +++++++++---------- 1 file changed, 36 insertions(+), 37 deletions(-) diff --git a/FlowCrypt/src/androidTest/java/com/flowcrypt/email/WkdClientTest.kt b/FlowCrypt/src/androidTest/java/com/flowcrypt/email/WkdClientTest.kt index b55144aaff..dd2f74f875 100644 --- a/FlowCrypt/src/androidTest/java/com/flowcrypt/email/WkdClientTest.kt +++ b/FlowCrypt/src/androidTest/java/com/flowcrypt/email/WkdClientTest.kt @@ -24,7 +24,6 @@ import org.apache.commons.codec.binary.ZBase32 import org.apache.commons.codec.digest.DigestUtils import org.junit.Assert.assertNull import org.junit.Assert.assertTrue -import org.junit.ClassRule import org.junit.Rule import org.junit.Test import org.junit.rules.RuleChain @@ -38,10 +37,46 @@ import java.net.HttpURLConnection class WkdClientTest { private val context: Context = ApplicationProvider.getApplicationContext() + private val mockWebServerRule = FlowCryptMockWebServerRule( + TestConstants.MOCK_WEB_SERVER_PORT, + object : Dispatcher() { + override fun dispatch(request: RecordedRequest): MockResponse { + val gson = ApiHelper.getInstance(ApplicationProvider.getApplicationContext()).gson + + when (request.path) { + "/.well-known/openpgpkey/policy" -> { + return MockResponse().setResponseCode(HttpURLConnection.HTTP_OK) + } + + genLookupUrlPath(EXISTING_EMAIL) -> { + return MockResponse().setResponseCode(HttpURLConnection.HTTP_OK) + .setBody( + PGPainless.generateKeyRing().simpleEcKeyRing(EXISTING_EMAIL).publicKey.armor() + ) + } + + genLookupUrlPath(NOT_EXISTING_EMAIL) -> { + return MockResponse().setResponseCode(HttpURLConnection.HTTP_NOT_FOUND) + .setBody( + gson.toJson( + ApiError( + code = HttpURLConnection.HTTP_NOT_FOUND, + message = "Public key not found" + ) + ) + ) + } + } + + return MockResponse().setResponseCode(HttpURLConnection.HTTP_NOT_FOUND) + } + }) + @get:Rule var ruleChain: TestRule = RuleChain .outerRule(ClearAppSettingsRule()) .around(GrantPermissionRuleChooser.grant(android.Manifest.permission.POST_NOTIFICATIONS)) + .around(mockWebServerRule) @Test fun existingEmailFlowCryptDomainTest() = runBlocking { @@ -75,42 +110,6 @@ class WkdClientTest { const val EXISTING_EMAIL = "existing@flowcrypt.test" const val NOT_EXISTING_EMAIL = "not_existing@flowcrypt.test" - @get:ClassRule - @JvmStatic - val mockWebServerRule = FlowCryptMockWebServerRule(TestConstants.MOCK_WEB_SERVER_PORT, - object : Dispatcher() { - override fun dispatch(request: RecordedRequest): MockResponse { - val gson = ApiHelper.getInstance(ApplicationProvider.getApplicationContext()).gson - - when (request.path) { - "/.well-known/openpgpkey/policy" -> { - return MockResponse().setResponseCode(HttpURLConnection.HTTP_OK) - } - - genLookupUrlPath(EXISTING_EMAIL) -> { - return MockResponse().setResponseCode(HttpURLConnection.HTTP_OK) - .setBody( - PGPainless.generateKeyRing().simpleEcKeyRing(EXISTING_EMAIL).publicKey.armor() - ) - } - - genLookupUrlPath(NOT_EXISTING_EMAIL) -> { - return MockResponse().setResponseCode(HttpURLConnection.HTTP_NOT_FOUND) - .setBody( - gson.toJson( - ApiError( - code = HttpURLConnection.HTTP_NOT_FOUND, - message = "Public key not found" - ) - ) - ) - } - } - - return MockResponse().setResponseCode(HttpURLConnection.HTTP_NOT_FOUND) - } - }) - private fun genLookupUrlPath(email: String): String { val user = email.substringBefore("@") val hu = ZBase32().encodeAsString(DigestUtils.sha1(user.toByteArray()))