Skip to content

Commit

Permalink
Various fixes to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dllewellyn committed Sep 23, 2023
1 parent 0410257 commit 1684c64
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<PackageManager>(relaxed = true).apply {
every {
Expand Down Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit 1684c64

Please sign in to comment.