This commit is contained in:
@ -18,6 +18,18 @@ import org.junit.Assert.assertNotEquals
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
|
||||
private const val BASE_URL = "https://test.com/selfoss/"
|
||||
|
||||
private const val SPOUT = "spouts\\rss\\fulltextrss"
|
||||
|
||||
private const val IMAGE_URL = "b3aa8a664d08eb15d6ff1db2fa83e0d9.png"
|
||||
|
||||
private const val IMAGE_URL_2 = "d8c92cdb1ef119ea85c4b9205c879ca7.png"
|
||||
|
||||
private const val FEED_URL = "https://test.com/feed"
|
||||
|
||||
private const val TAGS = "Test, New"
|
||||
|
||||
class RepositoryTest {
|
||||
private val db = mockk<ReaderForSelfossDB>(relaxed = true)
|
||||
private val appSettingsService = mockk<AppSettingsService>()
|
||||
@ -45,7 +57,7 @@ class RepositoryTest {
|
||||
fun setup() {
|
||||
clearAllMocks()
|
||||
every { appSettingsService.getApiVersion() } returns 4
|
||||
every { appSettingsService.getBaseUrl() } returns "https://test.com/selfoss/"
|
||||
every { appSettingsService.getBaseUrl() } returns BASE_URL
|
||||
every { appSettingsService.isItemCachingEnabled() } returns false
|
||||
every { appSettingsService.isUpdateSourcesEnabled() } returns false
|
||||
|
||||
@ -229,9 +241,9 @@ class RepositoryTest {
|
||||
1,
|
||||
"Test",
|
||||
listOf("tags"),
|
||||
"spouts\\rss\\fulltextrss",
|
||||
SPOUT,
|
||||
"",
|
||||
"b3aa8a664d08eb15d6ff1db2fa83e0d9.png",
|
||||
IMAGE_URL,
|
||||
SelfossModel.SourceParams("url")
|
||||
))
|
||||
runBlocking {
|
||||
@ -550,18 +562,18 @@ class RepositoryTest {
|
||||
1,
|
||||
"First source",
|
||||
listOf("Test", "second"),
|
||||
"spouts\\rss\\fulltextrss",
|
||||
SPOUT,
|
||||
"",
|
||||
"d8c92cdb1ef119ea85c4b9205c879ca7.png",
|
||||
IMAGE_URL_2,
|
||||
SelfossModel.SourceParams("url")
|
||||
),
|
||||
SelfossModel.Source(
|
||||
2,
|
||||
"Second source",
|
||||
listOf("second"),
|
||||
"spouts\\rss\\fulltextrss",
|
||||
SPOUT,
|
||||
"",
|
||||
"b3aa8a664d08eb15d6ff1db2fa83e0d9.png",
|
||||
IMAGE_URL,
|
||||
SelfossModel.SourceParams("url")
|
||||
)
|
||||
)
|
||||
@ -570,18 +582,18 @@ class RepositoryTest {
|
||||
"1",
|
||||
"First DB source",
|
||||
"Test,second",
|
||||
"spouts\\rss\\fulltextrss",
|
||||
SPOUT,
|
||||
"",
|
||||
"d8c92cdb1ef119ea85c4b9205c879ca7.png",
|
||||
IMAGE_URL_2,
|
||||
"url"
|
||||
),
|
||||
SOURCE(
|
||||
"2",
|
||||
"Second source",
|
||||
"second",
|
||||
"spouts\\rss\\fulltextrss",
|
||||
SPOUT,
|
||||
"",
|
||||
"b3aa8a664d08eb15d6ff1db2fa83e0d9.png",
|
||||
IMAGE_URL,
|
||||
"url"
|
||||
)
|
||||
)
|
||||
@ -720,9 +732,9 @@ class RepositoryTest {
|
||||
runBlocking {
|
||||
response = repository.createSource(
|
||||
"test",
|
||||
"https://test.com/feed",
|
||||
"spouts\\rss\\fulltextrss",
|
||||
"Test, New",
|
||||
FEED_URL,
|
||||
SPOUT,
|
||||
TAGS,
|
||||
)
|
||||
}
|
||||
|
||||
@ -747,9 +759,9 @@ class RepositoryTest {
|
||||
runBlocking {
|
||||
response = repository.createSource(
|
||||
"test",
|
||||
"https://test.com/feed",
|
||||
"spouts\\rss\\fulltextrss",
|
||||
"Test, New"
|
||||
FEED_URL,
|
||||
SPOUT,
|
||||
TAGS
|
||||
)
|
||||
}
|
||||
|
||||
@ -774,9 +786,9 @@ class RepositoryTest {
|
||||
runBlocking {
|
||||
response = repository.createSource(
|
||||
"test",
|
||||
"https://test.com/feed",
|
||||
"spouts\\rss\\fulltextrss",
|
||||
"Test, New"
|
||||
FEED_URL,
|
||||
SPOUT,
|
||||
TAGS
|
||||
)
|
||||
}
|
||||
|
||||
@ -952,12 +964,12 @@ class RepositoryTest {
|
||||
coEvery { appSettingsService.refreshLoginInformation(any(), any(), any()) } returns Unit
|
||||
|
||||
initializeRepository()
|
||||
repository.refreshLoginInformation("https://test.com/selfoss/", "login", "password")
|
||||
repository.refreshLoginInformation(BASE_URL, "login", "password")
|
||||
|
||||
coVerify(exactly = 1) { api.refreshLoginInformation() }
|
||||
coVerify(exactly = 1) {
|
||||
appSettingsService.refreshLoginInformation(
|
||||
"https://test.com/selfoss/",
|
||||
BASE_URL,
|
||||
"login",
|
||||
"password"
|
||||
)
|
||||
@ -1031,9 +1043,9 @@ class RepositoryTest {
|
||||
1,
|
||||
"First source",
|
||||
listOf("Test", "second"),
|
||||
"spouts\\rss\\fulltextrss",
|
||||
SPOUT,
|
||||
"",
|
||||
"d8c92cdb1ef119ea85c4b9205c879ca7.png",
|
||||
IMAGE_URL_2,
|
||||
SelfossModel.SourceParams("url")
|
||||
)
|
||||
)
|
||||
|
Reference in New Issue
Block a user