run DB part with blockingGet

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2022-06-25 13:45:22 +02:00
parent ffe41182d1
commit 9a66240fe5
No known key found for this signature in database
GPG Key ID: 6CADC7E3523C308B

View File

@ -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)
}
}