-
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.
- Loading branch information
Showing
2 changed files
with
18 additions
and
28 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -70,6 +70,20 @@ class RefreshKeysFromEkmFlowTest : BaseRefreshKeysFromEkmFlowTest() { | |
.around(activityScenarioRule) | ||
.around(ScreenshotTestRule()) | ||
|
||
override fun handleEkmAPI(gson: Gson): MockResponse { | ||
return when (testNameRule.methodName) { | ||
"testUpdatePrvKeyFromEkmSuccessSilent", "testUpdatePrvKeyFromEkmShowFixMissingPassphrase" -> | ||
MockResponse().setResponseCode(HttpURLConnection.HTTP_OK) | ||
.setBody(gson.toJson(EKM_RESPONSE_SUCCESS)) | ||
|
||
"testUpdatePrvKeyFromEkmShowApiError" -> | ||
MockResponse().setResponseCode(HttpURLConnection.HTTP_OK) | ||
.setBody(gson.toJson(EKM_ERROR_RESPONSE)) | ||
|
||
else -> MockResponse().setResponseCode(HttpURLConnection.HTTP_NOT_FOUND) | ||
} | ||
} | ||
|
||
@Test | ||
fun testUpdatePrvKeyFromEkmSuccessSilent() { | ||
val keysStorage = KeysStorageImpl.getInstance(getTargetContext()) | ||
|
@@ -164,20 +178,6 @@ class RefreshKeysFromEkmFlowTest : BaseRefreshKeysFromEkmFlowTest() { | |
return existingPgpKeyDetailsBeforeUpdating | ||
} | ||
|
||
override fun handleEkmAPI(gson: Gson): MockResponse { | ||
return when (testNameRule.methodName) { | ||
"testUpdatePrvKeyFromEkmSuccessSilent", "testUpdatePrvKeyFromEkmShowFixMissingPassphrase" -> | ||
MockResponse().setResponseCode(HttpURLConnection.HTTP_OK) | ||
.setBody(gson.toJson(EKM_RESPONSE_SUCCESS)) | ||
|
||
"testUpdatePrvKeyFromEkmShowApiError" -> | ||
MockResponse().setResponseCode(HttpURLConnection.HTTP_OK) | ||
.setBody(gson.toJson(EKM_ERROR_RESPONSE)) | ||
|
||
else -> MockResponse().setResponseCode(HttpURLConnection.HTTP_NOT_FOUND) | ||
} | ||
} | ||
|
||
companion object { | ||
private val EKM_KEY_WITH_EXTENDED_EXPIRATION = PrivateKeysManager.getPgpKeyDetailsFromAssets( | ||
"pgp/[email protected]_prv_default.asc" | ||
|
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