mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-05 03:44:36 -05:00
Fix tests (#2049)
* Fix test setup * Fix tests * Disable broken CloudflareTest * Add a basic test for Android's Looper
This commit is contained in:
@@ -1,17 +1,22 @@
|
||||
package masstest
|
||||
|
||||
import android.os.Looper
|
||||
import eu.kanade.tachiyomi.source.online.HttpSource
|
||||
import io.github.oshai.kotlinlogging.KotlinLogging
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import org.junit.jupiter.api.AfterAll
|
||||
import org.junit.jupiter.api.BeforeAll
|
||||
import org.junit.jupiter.api.Disabled
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.TestInstance
|
||||
import org.koin.core.context.stopKoin
|
||||
import suwayomi.tachidesk.manga.impl.Source
|
||||
import suwayomi.tachidesk.manga.impl.extension.Extension
|
||||
import suwayomi.tachidesk.manga.impl.extension.ExtensionsList
|
||||
import suwayomi.tachidesk.manga.impl.util.source.GetCatalogueSource
|
||||
import suwayomi.tachidesk.server.applicationSetup
|
||||
import suwayomi.tachidesk.server.settings.SettingsRegistry
|
||||
import suwayomi.tachidesk.test.BASE_PATH
|
||||
import suwayomi.tachidesk.test.setLoggingEnabled
|
||||
import xyz.nulldev.ts.config.CONFIG_PREFIX
|
||||
@@ -25,8 +30,11 @@ class CloudFlareTest {
|
||||
fun setup() {
|
||||
val dataRoot = File(BASE_PATH).absolutePath
|
||||
System.setProperty("$CONFIG_PREFIX.server.rootDir", dataRoot)
|
||||
Looper.clearMainLooperForTest()
|
||||
SettingsRegistry.clear()
|
||||
applicationSetup()
|
||||
setLoggingEnabled(false)
|
||||
return
|
||||
|
||||
runBlocking {
|
||||
val extensions = ExtensionsList.getExtensionList()
|
||||
@@ -48,9 +56,15 @@ class CloudFlareTest {
|
||||
setLoggingEnabled(true)
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
fun teardown() {
|
||||
stopKoin()
|
||||
}
|
||||
|
||||
private val logger = KotlinLogging.logger {}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
fun `test nhentai browse`() =
|
||||
runTest {
|
||||
assert(nhentai.getPopularManga(1).mangas.isNotEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user