Fixing tests.
This commit is contained in:
parent
8ea46e146b
commit
9e8a25ed3e
@ -4,6 +4,8 @@ import bou.amine.apps.readerforselfossv2.dao.ReaderForSelfossDB
|
|||||||
import bou.amine.apps.readerforselfossv2.dao.SOURCE
|
import bou.amine.apps.readerforselfossv2.dao.SOURCE
|
||||||
import bou.amine.apps.readerforselfossv2.dao.TAG
|
import bou.amine.apps.readerforselfossv2.dao.TAG
|
||||||
import bou.amine.apps.readerforselfossv2.model.SelfossModel
|
import bou.amine.apps.readerforselfossv2.model.SelfossModel
|
||||||
|
import bou.amine.apps.readerforselfossv2.model.StatusAndData
|
||||||
|
import bou.amine.apps.readerforselfossv2.model.SuccessResponse
|
||||||
import bou.amine.apps.readerforselfossv2.rest.SelfossApi
|
import bou.amine.apps.readerforselfossv2.rest.SelfossApi
|
||||||
import bou.amine.apps.readerforselfossv2.service.AppSettingsService
|
import bou.amine.apps.readerforselfossv2.service.AppSettingsService
|
||||||
import bou.amine.apps.readerforselfossv2.utils.ItemType
|
import bou.amine.apps.readerforselfossv2.utils.ItemType
|
||||||
@ -47,11 +49,11 @@ class RepositoryTest {
|
|||||||
every { appSettingsService.isItemCachingEnabled() } returns false
|
every { appSettingsService.isItemCachingEnabled() } returns false
|
||||||
every { appSettingsService.isUpdateSourcesEnabled() } returns false
|
every { appSettingsService.isUpdateSourcesEnabled() } returns false
|
||||||
|
|
||||||
coEvery { api.version() } returns SelfossModel.StatusAndData(
|
coEvery { api.version() } returns StatusAndData(
|
||||||
success = true,
|
success = true,
|
||||||
data = SelfossModel.ApiVersion("2.19-ba1e8e3", "4.0.0")
|
data = SelfossModel.ApiVersion("2.19-ba1e8e3", "4.0.0")
|
||||||
)
|
)
|
||||||
coEvery { api.stats() } returns SelfossModel.StatusAndData(
|
coEvery { api.stats() } returns StatusAndData(
|
||||||
success = true,
|
success = true,
|
||||||
data = SelfossModel.Stats(NUMBER_ARTICLES, NUMBER_UNREAD, NUMBER_STARRED)
|
data = SelfossModel.Stats(NUMBER_ARTICLES, NUMBER_UNREAD, NUMBER_STARRED)
|
||||||
)
|
)
|
||||||
@ -83,7 +85,7 @@ class RepositoryTest {
|
|||||||
fun get_api_4_date_with_api_1_version_stored() {
|
fun get_api_4_date_with_api_1_version_stored() {
|
||||||
every { appSettingsService.getApiVersion() } returns 1
|
every { appSettingsService.getApiVersion() } returns 1
|
||||||
coEvery { api.getItems(any(), any(), any(), any(), any(), any(), any()) } returns
|
coEvery { api.getItems(any(), any(), any(), any(), any(), any(), any()) } returns
|
||||||
SelfossModel.StatusAndData(success = true, data = generateTestApiItem())
|
StatusAndData(success = true, data = generateTestApiItem())
|
||||||
every { appSettingsService.updateApiVersion(any()) } returns Unit
|
every { appSettingsService.updateApiVersion(any()) } returns Unit
|
||||||
|
|
||||||
initializeRepository()
|
initializeRepository()
|
||||||
@ -98,11 +100,11 @@ class RepositoryTest {
|
|||||||
@Test
|
@Test
|
||||||
fun get_api_1_date_with_api_4_version_stored() {
|
fun get_api_1_date_with_api_4_version_stored() {
|
||||||
every { appSettingsService.getApiVersion() } returns 4
|
every { appSettingsService.getApiVersion() } returns 4
|
||||||
coEvery { api.version() } returns SelfossModel.StatusAndData(success = false, null)
|
coEvery { api.version() } returns StatusAndData(success = false, null)
|
||||||
val itemParameters = FakeItemParameters()
|
val itemParameters = FakeItemParameters()
|
||||||
itemParameters.datetime = "2021-04-23 11:45:32"
|
itemParameters.datetime = "2021-04-23 11:45:32"
|
||||||
coEvery { api.getItems(any(), any(), any(), any(), any(), any(), any()) } returns
|
coEvery { api.getItems(any(), any(), any(), any(), any(), any(), any()) } returns
|
||||||
SelfossModel.StatusAndData(
|
StatusAndData(
|
||||||
success = true,
|
success = true,
|
||||||
data = generateTestApiItem(itemParameters)
|
data = generateTestApiItem(itemParameters)
|
||||||
)
|
)
|
||||||
@ -118,7 +120,7 @@ class RepositoryTest {
|
|||||||
@Test
|
@Test
|
||||||
fun get_newer_items() {
|
fun get_newer_items() {
|
||||||
coEvery { api.getItems(any(), any(), any(), any(), any(), any(), any()) } returns
|
coEvery { api.getItems(any(), any(), any(), any(), any(), any(), any()) } returns
|
||||||
SelfossModel.StatusAndData(success = true, data = generateTestApiItem())
|
StatusAndData(success = true, data = generateTestApiItem())
|
||||||
|
|
||||||
initializeRepository()
|
initializeRepository()
|
||||||
runBlocking {
|
runBlocking {
|
||||||
@ -133,7 +135,7 @@ class RepositoryTest {
|
|||||||
@Test
|
@Test
|
||||||
fun get_all_newer_items() {
|
fun get_all_newer_items() {
|
||||||
coEvery { api.getItems(any(), any(), any(), any(), any(), any(), any()) } returns
|
coEvery { api.getItems(any(), any(), any(), any(), any(), any(), any()) } returns
|
||||||
SelfossModel.StatusAndData(success = true, data = generateTestApiItem())
|
StatusAndData(success = true, data = generateTestApiItem())
|
||||||
|
|
||||||
initializeRepository()
|
initializeRepository()
|
||||||
repository.displayedItems = ItemType.ALL
|
repository.displayedItems = ItemType.ALL
|
||||||
@ -149,7 +151,7 @@ class RepositoryTest {
|
|||||||
@Test
|
@Test
|
||||||
fun get_newer_starred_items() {
|
fun get_newer_starred_items() {
|
||||||
coEvery { api.getItems(any(), any(), any(), any(), any(), any(), any()) } returns
|
coEvery { api.getItems(any(), any(), any(), any(), any(), any(), any()) } returns
|
||||||
SelfossModel.StatusAndData(success = true, data = generateTestApiItem())
|
StatusAndData(success = true, data = generateTestApiItem())
|
||||||
|
|
||||||
initializeRepository()
|
initializeRepository()
|
||||||
repository.displayedItems = ItemType.STARRED
|
repository.displayedItems = ItemType.STARRED
|
||||||
@ -242,7 +244,7 @@ class RepositoryTest {
|
|||||||
@Test
|
@Test
|
||||||
fun get_older_items() {
|
fun get_older_items() {
|
||||||
coEvery { api.getItems(any(), any(), any(), any(), any(), any(), any()) } returns
|
coEvery { api.getItems(any(), any(), any(), any(), any(), any(), any()) } returns
|
||||||
SelfossModel.StatusAndData(success = true, data = generateTestApiItem())
|
StatusAndData(success = true, data = generateTestApiItem())
|
||||||
|
|
||||||
initializeRepository()
|
initializeRepository()
|
||||||
repository.items = ArrayList(generateTestApiItem())
|
repository.items = ArrayList(generateTestApiItem())
|
||||||
@ -258,7 +260,7 @@ class RepositoryTest {
|
|||||||
@Test
|
@Test
|
||||||
fun get_all_older_items() {
|
fun get_all_older_items() {
|
||||||
coEvery { api.getItems(any(), any(), any(), any(), any(), any(), any()) } returns
|
coEvery { api.getItems(any(), any(), any(), any(), any(), any(), any()) } returns
|
||||||
SelfossModel.StatusAndData(success = true, data = generateTestApiItem())
|
StatusAndData(success = true, data = generateTestApiItem())
|
||||||
|
|
||||||
initializeRepository()
|
initializeRepository()
|
||||||
repository.items = ArrayList(generateTestApiItem())
|
repository.items = ArrayList(generateTestApiItem())
|
||||||
@ -275,7 +277,7 @@ class RepositoryTest {
|
|||||||
@Test
|
@Test
|
||||||
fun get_older_starred_items() {
|
fun get_older_starred_items() {
|
||||||
coEvery { api.getItems(any(), any(), any(), any(), any(), any(), any()) } returns
|
coEvery { api.getItems(any(), any(), any(), any(), any(), any(), any()) } returns
|
||||||
SelfossModel.StatusAndData(success = true, data = generateTestApiItem())
|
StatusAndData(success = true, data = generateTestApiItem())
|
||||||
|
|
||||||
initializeRepository()
|
initializeRepository()
|
||||||
repository.displayedItems = ItemType.STARRED
|
repository.displayedItems = ItemType.STARRED
|
||||||
@ -308,7 +310,7 @@ class RepositoryTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun reload_badges_without_response() {
|
fun reload_badges_without_response() {
|
||||||
coEvery { api.stats() } returns SelfossModel.StatusAndData(success = false, data = null)
|
coEvery { api.stats() } returns StatusAndData(success = false, data = null)
|
||||||
|
|
||||||
var success: Boolean
|
var success: Boolean
|
||||||
|
|
||||||
@ -376,7 +378,7 @@ class RepositoryTest {
|
|||||||
TAG("second_DB", "yellow", 0)
|
TAG("second_DB", "yellow", 0)
|
||||||
)
|
)
|
||||||
|
|
||||||
coEvery { api.tags() } returns SelfossModel.StatusAndData(success = true, data = tags)
|
coEvery { api.tags() } returns StatusAndData(success = true, data = tags)
|
||||||
coEvery { db.tagsQueries.tags().executeAsList() } returns tagsDB
|
coEvery { db.tagsQueries.tags().executeAsList() } returns tagsDB
|
||||||
every { appSettingsService.isUpdateSourcesEnabled() } returns true
|
every { appSettingsService.isUpdateSourcesEnabled() } returns true
|
||||||
every { appSettingsService.isItemCachingEnabled() } returns true
|
every { appSettingsService.isItemCachingEnabled() } returns true
|
||||||
@ -403,7 +405,7 @@ class RepositoryTest {
|
|||||||
TAG("second_DB", "yellow", 0)
|
TAG("second_DB", "yellow", 0)
|
||||||
)
|
)
|
||||||
|
|
||||||
coEvery { api.tags() } returns SelfossModel.StatusAndData(success = true, data = tags)
|
coEvery { api.tags() } returns StatusAndData(success = true, data = tags)
|
||||||
coEvery { db.tagsQueries.tags().executeAsList() } returns tagsDB
|
coEvery { db.tagsQueries.tags().executeAsList() } returns tagsDB
|
||||||
every { appSettingsService.isUpdateSourcesEnabled() } returns false
|
every { appSettingsService.isUpdateSourcesEnabled() } returns false
|
||||||
every { appSettingsService.isItemCachingEnabled() } returns true
|
every { appSettingsService.isItemCachingEnabled() } returns true
|
||||||
@ -433,7 +435,7 @@ class RepositoryTest {
|
|||||||
TAG("second_DB", "yellow", 0)
|
TAG("second_DB", "yellow", 0)
|
||||||
)
|
)
|
||||||
|
|
||||||
coEvery { api.tags() } returns SelfossModel.StatusAndData(success = true, data = tags)
|
coEvery { api.tags() } returns StatusAndData(success = true, data = tags)
|
||||||
coEvery { db.tagsQueries.tags().executeAsList() } returns tagsDB
|
coEvery { db.tagsQueries.tags().executeAsList() } returns tagsDB
|
||||||
every { appSettingsService.isUpdateSourcesEnabled() } returns true
|
every { appSettingsService.isUpdateSourcesEnabled() } returns true
|
||||||
every { appSettingsService.isItemCachingEnabled() } returns false
|
every { appSettingsService.isItemCachingEnabled() } returns false
|
||||||
@ -460,7 +462,7 @@ class RepositoryTest {
|
|||||||
TAG("second_DB", "yellow", 0)
|
TAG("second_DB", "yellow", 0)
|
||||||
)
|
)
|
||||||
|
|
||||||
coEvery { api.tags() } returns SelfossModel.StatusAndData(success = true, data = tags)
|
coEvery { api.tags() } returns StatusAndData(success = true, data = tags)
|
||||||
coEvery { db.tagsQueries.tags().executeAsList() } returns tagsDB
|
coEvery { db.tagsQueries.tags().executeAsList() } returns tagsDB
|
||||||
every { appSettingsService.isUpdateSourcesEnabled() } returns false
|
every { appSettingsService.isUpdateSourcesEnabled() } returns false
|
||||||
every { appSettingsService.isItemCachingEnabled() } returns false
|
every { appSettingsService.isItemCachingEnabled() } returns false
|
||||||
@ -489,7 +491,7 @@ class RepositoryTest {
|
|||||||
TAG("second_DB", "yellow", 0)
|
TAG("second_DB", "yellow", 0)
|
||||||
)
|
)
|
||||||
|
|
||||||
coEvery { api.tags() } returns SelfossModel.StatusAndData(success = true, data = tags)
|
coEvery { api.tags() } returns StatusAndData(success = true, data = tags)
|
||||||
coEvery { db.tagsQueries.tags().executeAsList() } returns tagsDB
|
coEvery { db.tagsQueries.tags().executeAsList() } returns tagsDB
|
||||||
every { appSettingsService.isUpdateSourcesEnabled() } returns true
|
every { appSettingsService.isUpdateSourcesEnabled() } returns true
|
||||||
every { appSettingsService.isItemCachingEnabled() } returns true
|
every { appSettingsService.isItemCachingEnabled() } returns true
|
||||||
@ -517,7 +519,7 @@ class RepositoryTest {
|
|||||||
TAG("second_DB", "yellow", 0)
|
TAG("second_DB", "yellow", 0)
|
||||||
)
|
)
|
||||||
|
|
||||||
coEvery { api.tags() } returns SelfossModel.StatusAndData(success = true, data = tags)
|
coEvery { api.tags() } returns StatusAndData(success = true, data = tags)
|
||||||
coEvery { db.tagsQueries.tags().executeAsList() } returns tagsDB
|
coEvery { db.tagsQueries.tags().executeAsList() } returns tagsDB
|
||||||
every { appSettingsService.isItemCachingEnabled() } returns false
|
every { appSettingsService.isItemCachingEnabled() } returns false
|
||||||
every { appSettingsService.isUpdateSourcesEnabled() } returns true
|
every { appSettingsService.isUpdateSourcesEnabled() } returns true
|
||||||
@ -544,7 +546,7 @@ class RepositoryTest {
|
|||||||
TAG("second_DB", "yellow", 0)
|
TAG("second_DB", "yellow", 0)
|
||||||
)
|
)
|
||||||
|
|
||||||
coEvery { api.tags() } returns SelfossModel.StatusAndData(success = true, data = tags)
|
coEvery { api.tags() } returns StatusAndData(success = true, data = tags)
|
||||||
coEvery { db.tagsQueries.tags().executeAsList() } returns tagsDB
|
coEvery { db.tagsQueries.tags().executeAsList() } returns tagsDB
|
||||||
every { appSettingsService.isUpdateSourcesEnabled() } returns false
|
every { appSettingsService.isUpdateSourcesEnabled() } returns false
|
||||||
every { appSettingsService.isItemCachingEnabled() } returns true
|
every { appSettingsService.isItemCachingEnabled() } returns true
|
||||||
@ -572,7 +574,7 @@ class RepositoryTest {
|
|||||||
TAG("second_DB", "yellow", 0)
|
TAG("second_DB", "yellow", 0)
|
||||||
)
|
)
|
||||||
|
|
||||||
coEvery { api.tags() } returns SelfossModel.StatusAndData(success = true, data = tags)
|
coEvery { api.tags() } returns StatusAndData(success = true, data = tags)
|
||||||
coEvery { db.tagsQueries.tags().executeAsList() } returns tagsDB
|
coEvery { db.tagsQueries.tags().executeAsList() } returns tagsDB
|
||||||
every { appSettingsService.isUpdateSourcesEnabled() } returns false
|
every { appSettingsService.isUpdateSourcesEnabled() } returns false
|
||||||
every { appSettingsService.isItemCachingEnabled() } returns false
|
every { appSettingsService.isItemCachingEnabled() } returns false
|
||||||
@ -627,7 +629,7 @@ class RepositoryTest {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
coEvery { api.sources() } returns SelfossModel.StatusAndData(success = true, data = sources)
|
coEvery { api.sources() } returns StatusAndData(success = true, data = sources)
|
||||||
every { db.sourcesQueries.sources().executeAsList() } returns sourcesDB
|
every { db.sourcesQueries.sources().executeAsList() } returns sourcesDB
|
||||||
initializeRepository()
|
initializeRepository()
|
||||||
var testSources: List<SelfossModel.Source>?
|
var testSources: List<SelfossModel.Source>?
|
||||||
@ -681,7 +683,7 @@ class RepositoryTest {
|
|||||||
|
|
||||||
every { appSettingsService.isUpdateSourcesEnabled() } returns false
|
every { appSettingsService.isUpdateSourcesEnabled() } returns false
|
||||||
every { appSettingsService.isItemCachingEnabled() } returns true
|
every { appSettingsService.isItemCachingEnabled() } returns true
|
||||||
coEvery { api.sources() } returns SelfossModel.StatusAndData(success = true, data = sources)
|
coEvery { api.sources() } returns StatusAndData(success = true, data = sources)
|
||||||
every { db.sourcesQueries.sources().executeAsList() } returns sourcesDB
|
every { db.sourcesQueries.sources().executeAsList() } returns sourcesDB
|
||||||
initializeRepository()
|
initializeRepository()
|
||||||
var testSources: List<SelfossModel.Source>?
|
var testSources: List<SelfossModel.Source>?
|
||||||
@ -738,7 +740,7 @@ class RepositoryTest {
|
|||||||
|
|
||||||
every { appSettingsService.isUpdateSourcesEnabled() } returns true
|
every { appSettingsService.isUpdateSourcesEnabled() } returns true
|
||||||
every { appSettingsService.isItemCachingEnabled() } returns false
|
every { appSettingsService.isItemCachingEnabled() } returns false
|
||||||
coEvery { api.sources() } returns SelfossModel.StatusAndData(success = true, data = sources)
|
coEvery { api.sources() } returns StatusAndData(success = true, data = sources)
|
||||||
every { db.sourcesQueries.sources().executeAsList() } returns sourcesDB
|
every { db.sourcesQueries.sources().executeAsList() } returns sourcesDB
|
||||||
initializeRepository()
|
initializeRepository()
|
||||||
var testSources: List<SelfossModel.Source>?
|
var testSources: List<SelfossModel.Source>?
|
||||||
@ -792,7 +794,7 @@ class RepositoryTest {
|
|||||||
|
|
||||||
every { appSettingsService.isUpdateSourcesEnabled() } returns false
|
every { appSettingsService.isUpdateSourcesEnabled() } returns false
|
||||||
every { appSettingsService.isItemCachingEnabled() } returns false
|
every { appSettingsService.isItemCachingEnabled() } returns false
|
||||||
coEvery { api.sources() } returns SelfossModel.StatusAndData(success = true, data = sources)
|
coEvery { api.sources() } returns StatusAndData(success = true, data = sources)
|
||||||
every { db.sourcesQueries.sources().executeAsList() } returns sourcesDB
|
every { db.sourcesQueries.sources().executeAsList() } returns sourcesDB
|
||||||
initializeRepository()
|
initializeRepository()
|
||||||
var testSources: List<SelfossModel.Source>?
|
var testSources: List<SelfossModel.Source>?
|
||||||
@ -844,7 +846,7 @@ class RepositoryTest {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
coEvery { api.sources() } returns SelfossModel.StatusAndData(success = true, data = sources)
|
coEvery { api.sources() } returns StatusAndData(success = true, data = sources)
|
||||||
every { db.sourcesQueries.sources().executeAsList() } returns sourcesDB
|
every { db.sourcesQueries.sources().executeAsList() } returns sourcesDB
|
||||||
initializeRepository(MutableStateFlow(false))
|
initializeRepository(MutableStateFlow(false))
|
||||||
var testSources: List<SelfossModel.Source>?
|
var testSources: List<SelfossModel.Source>?
|
||||||
@ -898,7 +900,7 @@ class RepositoryTest {
|
|||||||
|
|
||||||
every { appSettingsService.isItemCachingEnabled() } returns false
|
every { appSettingsService.isItemCachingEnabled() } returns false
|
||||||
every { appSettingsService.isUpdateSourcesEnabled() } returns true
|
every { appSettingsService.isUpdateSourcesEnabled() } returns true
|
||||||
coEvery { api.sources() } returns SelfossModel.StatusAndData(success = true, data = sources)
|
coEvery { api.sources() } returns StatusAndData(success = true, data = sources)
|
||||||
every { db.sourcesQueries.sources().executeAsList() } returns sourcesDB
|
every { db.sourcesQueries.sources().executeAsList() } returns sourcesDB
|
||||||
initializeRepository(MutableStateFlow(false))
|
initializeRepository(MutableStateFlow(false))
|
||||||
var testSources: List<SelfossModel.Source>?
|
var testSources: List<SelfossModel.Source>?
|
||||||
@ -952,7 +954,7 @@ class RepositoryTest {
|
|||||||
|
|
||||||
every { appSettingsService.isItemCachingEnabled() } returns true
|
every { appSettingsService.isItemCachingEnabled() } returns true
|
||||||
every { appSettingsService.isUpdateSourcesEnabled() } returns false
|
every { appSettingsService.isUpdateSourcesEnabled() } returns false
|
||||||
coEvery { api.sources() } returns SelfossModel.StatusAndData(success = true, data = sources)
|
coEvery { api.sources() } returns StatusAndData(success = true, data = sources)
|
||||||
every { db.sourcesQueries.sources().executeAsList() } returns sourcesDB
|
every { db.sourcesQueries.sources().executeAsList() } returns sourcesDB
|
||||||
initializeRepository(MutableStateFlow(false))
|
initializeRepository(MutableStateFlow(false))
|
||||||
var testSources: List<SelfossModel.Source>?
|
var testSources: List<SelfossModel.Source>?
|
||||||
@ -1006,7 +1008,7 @@ class RepositoryTest {
|
|||||||
|
|
||||||
every { appSettingsService.isItemCachingEnabled() } returns false
|
every { appSettingsService.isItemCachingEnabled() } returns false
|
||||||
every { appSettingsService.isUpdateSourcesEnabled() } returns false
|
every { appSettingsService.isUpdateSourcesEnabled() } returns false
|
||||||
coEvery { api.sources() } returns SelfossModel.StatusAndData(success = true, data = sources)
|
coEvery { api.sources() } returns StatusAndData(success = true, data = sources)
|
||||||
every { db.sourcesQueries.sources().executeAsList() } returns sourcesDB
|
every { db.sourcesQueries.sources().executeAsList() } returns sourcesDB
|
||||||
initializeRepository(MutableStateFlow(false))
|
initializeRepository(MutableStateFlow(false))
|
||||||
var testSources: List<SelfossModel.Source>?
|
var testSources: List<SelfossModel.Source>?
|
||||||
@ -1022,7 +1024,7 @@ class RepositoryTest {
|
|||||||
@Test
|
@Test
|
||||||
fun create_source() {
|
fun create_source() {
|
||||||
coEvery { api.createSourceForVersion(any(), any(), any(), any(), any(), any()) } returns
|
coEvery { api.createSourceForVersion(any(), any(), any(), any(), any(), any()) } returns
|
||||||
SelfossModel.SuccessResponse(true)
|
SuccessResponse(true)
|
||||||
|
|
||||||
initializeRepository()
|
initializeRepository()
|
||||||
var response: Boolean
|
var response: Boolean
|
||||||
@ -1052,7 +1054,7 @@ class RepositoryTest {
|
|||||||
@Test
|
@Test
|
||||||
fun create_source_but_response_fails() {
|
fun create_source_but_response_fails() {
|
||||||
coEvery { api.createSourceForVersion(any(), any(), any(), any(), any(), any()) } returns
|
coEvery { api.createSourceForVersion(any(), any(), any(), any(), any(), any()) } returns
|
||||||
SelfossModel.SuccessResponse(false)
|
SuccessResponse(false)
|
||||||
|
|
||||||
initializeRepository()
|
initializeRepository()
|
||||||
var response: Boolean
|
var response: Boolean
|
||||||
@ -1082,7 +1084,7 @@ class RepositoryTest {
|
|||||||
@Test
|
@Test
|
||||||
fun create_source_without_connection() {
|
fun create_source_without_connection() {
|
||||||
coEvery { api.createSourceForVersion(any(), any(), any(), any(), any(), any()) } returns
|
coEvery { api.createSourceForVersion(any(), any(), any(), any(), any(), any()) } returns
|
||||||
SelfossModel.SuccessResponse(true)
|
SuccessResponse(true)
|
||||||
|
|
||||||
initializeRepository(MutableStateFlow(false))
|
initializeRepository(MutableStateFlow(false))
|
||||||
var response: Boolean
|
var response: Boolean
|
||||||
@ -1111,7 +1113,7 @@ class RepositoryTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun delete_source() {
|
fun delete_source() {
|
||||||
coEvery { api.deleteSource(any()) } returns SelfossModel.SuccessResponse(true)
|
coEvery { api.deleteSource(any()) } returns SuccessResponse(true)
|
||||||
|
|
||||||
initializeRepository()
|
initializeRepository()
|
||||||
var response: Boolean
|
var response: Boolean
|
||||||
@ -1125,7 +1127,7 @@ class RepositoryTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun delete_source_but_response_fails() {
|
fun delete_source_but_response_fails() {
|
||||||
coEvery { api.deleteSource(any()) } returns SelfossModel.SuccessResponse(false)
|
coEvery { api.deleteSource(any()) } returns SuccessResponse(false)
|
||||||
|
|
||||||
initializeRepository()
|
initializeRepository()
|
||||||
var response: Boolean
|
var response: Boolean
|
||||||
@ -1139,7 +1141,7 @@ class RepositoryTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun delete_source_without_connection() {
|
fun delete_source_without_connection() {
|
||||||
coEvery { api.deleteSource(any()) } returns SelfossModel.SuccessResponse(false)
|
coEvery { api.deleteSource(any()) } returns SuccessResponse(false)
|
||||||
|
|
||||||
initializeRepository(MutableStateFlow(false))
|
initializeRepository(MutableStateFlow(false))
|
||||||
var response: Boolean
|
var response: Boolean
|
||||||
@ -1153,7 +1155,7 @@ class RepositoryTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun update_remote() {
|
fun update_remote() {
|
||||||
coEvery { api.update() } returns SelfossModel.StatusAndData(
|
coEvery { api.update() } returns StatusAndData(
|
||||||
success = true,
|
success = true,
|
||||||
data = "finished"
|
data = "finished"
|
||||||
)
|
)
|
||||||
@ -1170,7 +1172,7 @@ class RepositoryTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun update_remote_but_response_fails() {
|
fun update_remote_but_response_fails() {
|
||||||
coEvery { api.update() } returns SelfossModel.StatusAndData(
|
coEvery { api.update() } returns StatusAndData(
|
||||||
success = false,
|
success = false,
|
||||||
data = "unallowed access"
|
data = "unallowed access"
|
||||||
)
|
)
|
||||||
@ -1187,7 +1189,7 @@ class RepositoryTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun update_remote_with_unallowed_access() {
|
fun update_remote_with_unallowed_access() {
|
||||||
coEvery { api.update() } returns SelfossModel.StatusAndData(
|
coEvery { api.update() } returns StatusAndData(
|
||||||
success = true,
|
success = true,
|
||||||
data = "unallowed access"
|
data = "unallowed access"
|
||||||
)
|
)
|
||||||
@ -1204,7 +1206,7 @@ class RepositoryTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun update_remote_without_connection() {
|
fun update_remote_without_connection() {
|
||||||
coEvery { api.update() } returns SelfossModel.StatusAndData(
|
coEvery { api.update() } returns StatusAndData(
|
||||||
success = true,
|
success = true,
|
||||||
data = "undocumented..."
|
data = "undocumented..."
|
||||||
)
|
)
|
||||||
@ -1221,7 +1223,7 @@ class RepositoryTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun login() {
|
fun login() {
|
||||||
coEvery { api.login() } returns SelfossModel.SuccessResponse(success = true)
|
coEvery { api.login() } returns SuccessResponse(success = true)
|
||||||
|
|
||||||
initializeRepository()
|
initializeRepository()
|
||||||
var response: Boolean
|
var response: Boolean
|
||||||
@ -1235,7 +1237,7 @@ class RepositoryTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun login_but_response_fails() {
|
fun login_but_response_fails() {
|
||||||
coEvery { api.login() } returns SelfossModel.SuccessResponse(success = false)
|
coEvery { api.login() } returns SuccessResponse(success = false)
|
||||||
|
|
||||||
initializeRepository()
|
initializeRepository()
|
||||||
var response: Boolean
|
var response: Boolean
|
||||||
@ -1249,7 +1251,7 @@ class RepositoryTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun login_but_without_connection() {
|
fun login_but_without_connection() {
|
||||||
coEvery { api.login() } returns SelfossModel.SuccessResponse(success = true)
|
coEvery { api.login() } returns SuccessResponse(success = true)
|
||||||
|
|
||||||
initializeRepository(MutableStateFlow(false))
|
initializeRepository(MutableStateFlow(false))
|
||||||
var response: Boolean
|
var response: Boolean
|
||||||
@ -1297,9 +1299,9 @@ class RepositoryTest {
|
|||||||
any()
|
any()
|
||||||
)
|
)
|
||||||
} returnsMany listOf(
|
} returnsMany listOf(
|
||||||
SelfossModel.StatusAndData(success = true, data = generateTestApiItem(itemParameter1)),
|
StatusAndData(success = true, data = generateTestApiItem(itemParameter1)),
|
||||||
SelfossModel.StatusAndData(success = true, data = generateTestApiItem(itemParameter2)),
|
StatusAndData(success = true, data = generateTestApiItem(itemParameter2)),
|
||||||
SelfossModel.StatusAndData(success = true, data = generateTestApiItem(itemParameter1)),
|
StatusAndData(success = true, data = generateTestApiItem(itemParameter1)),
|
||||||
)
|
)
|
||||||
|
|
||||||
initializeRepository()
|
initializeRepository()
|
||||||
@ -1323,7 +1325,7 @@ class RepositoryTest {
|
|||||||
@Test
|
@Test
|
||||||
fun cache_items_but_response_fails() {
|
fun cache_items_but_response_fails() {
|
||||||
coEvery { api.getItems(any(), any(), any(), any(), any(), any(), any()) } returns
|
coEvery { api.getItems(any(), any(), any(), any(), any(), any(), any()) } returns
|
||||||
SelfossModel.StatusAndData(success = false, data = generateTestApiItem())
|
StatusAndData(success = false, data = generateTestApiItem())
|
||||||
|
|
||||||
initializeRepository()
|
initializeRepository()
|
||||||
repository.tagFilter = SelfossModel.Tag("Tag", "read", 0)
|
repository.tagFilter = SelfossModel.Tag("Tag", "read", 0)
|
||||||
@ -1346,7 +1348,7 @@ class RepositoryTest {
|
|||||||
@Test
|
@Test
|
||||||
fun cache_items_without_connection() {
|
fun cache_items_without_connection() {
|
||||||
coEvery { api.getItems(any(), any(), any(), any(), any(), any(), any()) } returns
|
coEvery { api.getItems(any(), any(), any(), any(), any(), any(), any()) } returns
|
||||||
SelfossModel.StatusAndData(success = false, data = generateTestApiItem())
|
StatusAndData(success = false, data = generateTestApiItem())
|
||||||
|
|
||||||
initializeRepository(MutableStateFlow(false))
|
initializeRepository(MutableStateFlow(false))
|
||||||
repository.tagFilter = SelfossModel.Tag("Tag", "read", 0)
|
repository.tagFilter = SelfossModel.Tag("Tag", "read", 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user