From 27698428bb1ec50b704038c3b170167bb32e0f28 Mon Sep 17 00:00:00 2001 From: DenBond7 Date: Mon, 27 Feb 2023 10:25:09 +0200 Subject: [PATCH] Refactored code.| #2162 --- ...itPublicKeyToAttesterForImportedKeyDuringSetupFlowTest.kt | 4 +--- .../ui/activity/enterprise/AddNewAccountEnterpriseTest.kt | 5 +---- .../jetpack/workmanager/HandlePasswordProtectedMsgWorker.kt | 3 +-- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/SubmitPublicKeyToAttesterForImportedKeyDuringSetupFlowTest.kt b/FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/SubmitPublicKeyToAttesterForImportedKeyDuringSetupFlowTest.kt index ecdb9b5d43..38ce8ebbd8 100644 --- a/FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/SubmitPublicKeyToAttesterForImportedKeyDuringSetupFlowTest.kt +++ b/FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/SubmitPublicKeyToAttesterForImportedKeyDuringSetupFlowTest.kt @@ -24,7 +24,6 @@ import com.flowcrypt.email.api.retrofit.response.api.ClientConfigurationResponse import com.flowcrypt.email.api.retrofit.response.api.FesServerResponse import com.flowcrypt.email.api.retrofit.response.base.ApiError import com.flowcrypt.email.api.retrofit.response.model.ClientConfiguration -import com.flowcrypt.email.extensions.kotlin.urlDecoded import com.flowcrypt.email.extensions.org.bouncycastle.openpgp.toPgpKeyDetails import com.flowcrypt.email.rules.ClearAppSettingsRule import com.flowcrypt.email.rules.FlowCryptMockWebServerRule @@ -174,8 +173,7 @@ class SubmitPublicKeyToAttesterForImportedKeyDuringSetupFlowTest : BaseSignTest( request.path == "api" -> MockResponse().setResponseCode(HttpURLConnection.HTTP_OK) .setBody(gson.toJson(FES_SUCCESS_RESPONSE)) - request.path?.urlDecoded() - .equals("/shared-tenant-fes/api/v1/client-configuration?domain=flowcrypt.test") -> { + request.path.equals("/shared-tenant-fes/api/v1/client-configuration?domain=flowcrypt.test") -> { MockResponse().setResponseCode(HttpURLConnection.HTTP_OK) .setBody(gson.toJson(CLIENT_CONFIGURATION_RESPONSE)) } diff --git a/FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/activity/enterprise/AddNewAccountEnterpriseTest.kt b/FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/activity/enterprise/AddNewAccountEnterpriseTest.kt index 1f9cc7efe9..c260f3041f 100644 --- a/FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/activity/enterprise/AddNewAccountEnterpriseTest.kt +++ b/FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/activity/enterprise/AddNewAccountEnterpriseTest.kt @@ -18,7 +18,6 @@ import com.flowcrypt.email.TestConstants import com.flowcrypt.email.api.retrofit.ApiHelper import com.flowcrypt.email.api.retrofit.response.api.ClientConfigurationResponse import com.flowcrypt.email.api.retrofit.response.model.ClientConfiguration -import com.flowcrypt.email.extensions.kotlin.urlDecoded import com.flowcrypt.email.junit.annotations.NotReadyForCI import com.flowcrypt.email.rules.AddAccountToDatabaseRule import com.flowcrypt.email.rules.ClearAppSettingsRule @@ -81,9 +80,7 @@ class AddNewAccountEnterpriseTest : BaseSignTest() { val gson = ApiHelper.getInstance(InstrumentationRegistry.getInstrumentation().targetContext).gson - if (request.path?.urlDecoded() - .equals("/api/v1/client-configuration?domain=localhost:1212") - ) { + if (request.path.equals("/api/v1/client-configuration?domain=flowcrypt.test")) { when (extractEmailFromRecordedRequest(request)) { EMAIL_WITH_NO_PRV_CREATE_RULE -> return MockResponse().setResponseCode( HttpURLConnection.HTTP_OK diff --git a/FlowCrypt/src/main/java/com/flowcrypt/email/jetpack/workmanager/HandlePasswordProtectedMsgWorker.kt b/FlowCrypt/src/main/java/com/flowcrypt/email/jetpack/workmanager/HandlePasswordProtectedMsgWorker.kt index 6217d816d0..79a79d49a9 100644 --- a/FlowCrypt/src/main/java/com/flowcrypt/email/jetpack/workmanager/HandlePasswordProtectedMsgWorker.kt +++ b/FlowCrypt/src/main/java/com/flowcrypt/email/jetpack/workmanager/HandlePasswordProtectedMsgWorker.kt @@ -15,9 +15,8 @@ import androidx.work.WorkerParameters import com.flowcrypt.email.R import com.flowcrypt.email.api.email.EmailUtil import com.flowcrypt.email.api.email.JavaEmailConstants -import com.flowcrypt.email.api.retrofit.ApiClientRepository import com.flowcrypt.email.api.email.javamail.PasswordProtectedAttachmentInfoDataSource -import com.flowcrypt.email.api.retrofit.FlowcryptApiRepository +import com.flowcrypt.email.api.retrofit.ApiClientRepository import com.flowcrypt.email.api.retrofit.request.model.MessageUploadRequest import com.flowcrypt.email.database.MessageState import com.flowcrypt.email.database.entity.AccountEntity