-
Notifications
You must be signed in to change notification settings - Fork 363
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
1 parent
897f462
commit a193531
Showing
27 changed files
with
684 additions
and
17 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
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
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
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
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
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
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
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
34 changes: 34 additions & 0 deletions
34
android/test/common/src/main/kotlin/net/mullvad/mullvadvpn/test/common/misc/Attachment.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,34 @@ | ||
package net.mullvad.mullvadvpn.test.common.misc | ||
|
||
import android.os.Environment | ||
import co.touchlab.kermit.Logger | ||
import java.io.File | ||
import java.io.IOException | ||
import org.junit.jupiter.api.fail | ||
|
||
object Attachment { | ||
private const val DIRECTORY_NAME = "test-attachments" | ||
private val testAttachmentsDirectory = | ||
File( | ||
Environment.getExternalStorageDirectory(), | ||
"${Environment.DIRECTORY_DOWNLOADS}/$DIRECTORY_NAME", | ||
) | ||
|
||
fun saveAttachment(fileName: String, data: ByteArray) { | ||
createAttachmentsDirectoryIfNotExists() | ||
|
||
val file = File(testAttachmentsDirectory, fileName) | ||
try { | ||
file.writeBytes(data) | ||
Logger.v("Saved attachment ${file.absolutePath}") | ||
} catch (e: IOException) { | ||
fail("Failed to save attachment $fileName: ${e.message}") | ||
} | ||
} | ||
|
||
private fun createAttachmentsDirectoryIfNotExists() { | ||
if (!testAttachmentsDirectory.exists() && !testAttachmentsDirectory.mkdirs()) { | ||
fail("Failed to create directory ${testAttachmentsDirectory.absolutePath}") | ||
} | ||
} | ||
} |
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
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
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 |
---|---|---|
@@ -1 +1,5 @@ | ||
API_VERSION=v1 | ||
ENABLE_HIGHLY_RATE_LIMITED_TESTS=false | ||
ENABLE_ACCESS_TO_LOCAL_API_TESTS=true | ||
TRAFFIC_GENERATION_IP_ADDRESS=45.83.223.209 | ||
PACKET_CAPTURE_API_HOST=192.168.105.1 |
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
Oops, something went wrong.