Skip to content

Commit

Permalink
update reference tests for protectionsState
Browse files Browse the repository at this point in the history
  • Loading branch information
Shane Osbourne committed Nov 10, 2023
1 parent 5939b1c commit 07d81d7
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@

package com.duckduckgo.app.referencetests.brokensites

import android.net.Uri
import com.duckduckgo.app.CoroutineTestRule
import com.duckduckgo.app.FileUtilities
import com.duckduckgo.app.brokensite.BrokenSiteViewModel
import com.duckduckgo.app.brokensite.api.BrokenSiteSubmitter
import com.duckduckgo.app.brokensite.model.BrokenSite
import com.duckduckgo.app.pixels.AppPixelName
import com.duckduckgo.app.privacy.db.UserAllowListRepository
import com.duckduckgo.app.statistics.Variant
import com.duckduckgo.app.statistics.VariantManager
import com.duckduckgo.app.statistics.model.Atb
Expand Down Expand Up @@ -78,6 +80,8 @@ class BrokenSitesReferenceTest(private val testCase: TestCase) {

private val mockPrivacyConfig: PrivacyConfig = mock()

private val mockUserAllowListRepository: UserAllowListRepository = mock()

private lateinit var testee: BrokenSiteSubmitter

companion object {
Expand Down Expand Up @@ -113,7 +117,7 @@ class BrokenSitesReferenceTest(private val testCase: TestCase) {
mockAppBuildConfig,
coroutineRule.testDispatcherProvider,
mockPrivacyConfig,
mock(),
mockUserAllowListRepository,
mock(),
mock(),
mock(),
Expand All @@ -134,6 +138,11 @@ class BrokenSitesReferenceTest(private val testCase: TestCase) {
PrivacyConfigData(version = testCase.remoteConfigVersion ?: "v", eTag = testCase.remoteConfigEtag ?: "e"),
)

if (!testCase.protectionsEnabled) {
val url = Uri.parse(testCase.siteURL).host
whenever(mockUserAllowListRepository.isDomainInUserAllowList(url)).thenReturn(true)
}

val brokenSite = BrokenSite(
category = testCase.category,
description = testCase.providedDescription,
Expand Down Expand Up @@ -191,6 +200,7 @@ class BrokenSitesReferenceTest(private val testCase: TestCase) {
val model: String?,
val os: String?,
val gpcEnabled: Boolean = false,
val protectionsEnabled: Boolean = true,
val expectReportURLPrefix: String,
val expectReportURLParams: List<UrlParam>,
val exceptPlatforms: List<String>,
Expand Down

0 comments on commit 07d81d7

Please sign in to comment.