From 1684c64047361c830ac5721a6e9cc0f9d287f525 Mon Sep 17 00:00:00 2001 From: Daniel Llewellyn Date: Sat, 23 Sep 2023 16:50:21 +0100 Subject: [PATCH] Various fixes to tests --- .../safetorun/plus/AndroidSafeToRunOffDeviceTest.kt | 11 +++++++++++ .../safetorun/plus/LoggerBackendSynchroniserTest.kt | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/safeToRunPlus/src/androidTest/kotlin/com/safetorun/plus/AndroidSafeToRunOffDeviceTest.kt b/safeToRunPlus/src/androidTest/kotlin/com/safetorun/plus/AndroidSafeToRunOffDeviceTest.kt index e2be85b7..d312f744 100644 --- a/safeToRunPlus/src/androidTest/kotlin/com/safetorun/plus/AndroidSafeToRunOffDeviceTest.kt +++ b/safeToRunPlus/src/androidTest/kotlin/com/safetorun/plus/AndroidSafeToRunOffDeviceTest.kt @@ -3,6 +3,7 @@ package com.safetorun.plus import com.safetorun.plus.models.DataWrappedLogResponse import android.content.Context import android.content.pm.PackageManager +import android.os.Build import com.google.common.truth.Truth.assertThat import com.safetorun.features.oscheck.OSInformationQuery import com.safetorun.logger.models.BlacklistedApps @@ -63,6 +64,14 @@ internal class AndroidSafeToRunOffDeviceTest : TestCase() { } every { osInformationQuery.manufacturer() } returns "MANUFACTURER" + every { osInformationQuery.osVersion() } returns Build.VERSION_CODES.TIRAMISU + every { osInformationQuery.model() } returns "Xiaomi" + every { osInformationQuery.bootloader() } returns "BOOTLOADER" + every { osInformationQuery.device() } returns "DEVICE" + every { osInformationQuery.cpuAbi() } returns emptyList() + every { osInformationQuery.hardware() } returns "HARDWARE" + every { osInformationQuery.board() } returns "BOARD" + every { osInformationQuery.host() } returns "HOST" every { context.packageManager } returns mockk(relaxed = true).apply { every { @@ -147,11 +156,13 @@ internal class AndroidSafeToRunOffDeviceTest : TestCase() { apiKey, { INSTALLER_PACKAGE }, url = url, + osInformationQuery = osInformationQuery ) val safeToRun2 = safeToRunLogger( apiKey, { INSTALLER_PACKAGE }, url = url, + osInformationQuery = osInformationQuery ) assertThat(safeToRun).isNotNull() diff --git a/safeToRunPlus/src/androidTest/kotlin/com/safetorun/plus/LoggerBackendSynchroniserTest.kt b/safeToRunPlus/src/androidTest/kotlin/com/safetorun/plus/LoggerBackendSynchroniserTest.kt index b093b681..308a4c3b 100644 --- a/safeToRunPlus/src/androidTest/kotlin/com/safetorun/plus/LoggerBackendSynchroniserTest.kt +++ b/safeToRunPlus/src/androidTest/kotlin/com/safetorun/plus/LoggerBackendSynchroniserTest.kt @@ -35,7 +35,7 @@ internal class LoggerBackendSynchroniserTest : TestCase() { mockkStatic("com.safetorun.plus.AndroidSafeToRunOffDeviceKt") mockkStatic("com.safetorun.logger.BackendSynchKt") - every { safeToRunLogger(any(), any(), any(), any()) } returns { + every { safeToRunLogger(any(), any(), any(), any(), any()) } returns { listAtEnd.add(it) }