mirror of
https://github.com/nextcloud/talk-android
synced 2025-02-01 20:22:03 +00:00
run DB part with blockingGet
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
ffe41182d1
commit
9a66240fe5
@ -1,11 +1,8 @@
|
||||
package com.nextcloud.talk.activities
|
||||
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule
|
||||
import com.nextcloud.talk.data.user.model.User
|
||||
import com.nextcloud.talk.users.UserManager
|
||||
import io.reactivex.SingleObserver
|
||||
import io.reactivex.disposables.Disposable
|
||||
import org.junit.Assert.fail
|
||||
import org.junit.Assert.assertNotNull
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
|
||||
@ -21,7 +18,7 @@ class MainActivityTest {
|
||||
fun login() {
|
||||
val sut = activityRule.launchActivity(null)
|
||||
|
||||
sut.userManager.createOrUpdateUser(
|
||||
val user = sut.userManager.createOrUpdateUser(
|
||||
"test",
|
||||
UserManager.UserAttributes(
|
||||
id = 0,
|
||||
@ -35,20 +32,11 @@ class MainActivityTest {
|
||||
certificateAlias = null,
|
||||
externalSignalingServer = null
|
||||
)
|
||||
).subscribe(object : SingleObserver<User?> {
|
||||
override fun onSubscribe(d: Disposable) {
|
||||
// unused atm
|
||||
}
|
||||
).blockingGet()
|
||||
|
||||
override fun onSuccess(user: User) {
|
||||
sut.runOnUiThread { sut.resetConversationsList() }
|
||||
assertNotNull("Error creating user", user)
|
||||
|
||||
println("User: " + user.id + " / " + user.userId + " / " + user.baseUrl)
|
||||
}
|
||||
|
||||
override fun onError(e: Throwable) {
|
||||
fail("No user created")
|
||||
}
|
||||
})
|
||||
sut.runOnUiThread { sut.resetConversationsList() }
|
||||
println("User: " + user!!.id + " / " + user.userId + " / " + user.baseUrl)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user