mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-06 12:29:47 +01: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
|
package com.nextcloud.talk.activities
|
||||||
|
|
||||||
import androidx.test.espresso.intent.rule.IntentsTestRule
|
import androidx.test.espresso.intent.rule.IntentsTestRule
|
||||||
import com.nextcloud.talk.data.user.model.User
|
|
||||||
import com.nextcloud.talk.users.UserManager
|
import com.nextcloud.talk.users.UserManager
|
||||||
import io.reactivex.SingleObserver
|
import org.junit.Assert.assertNotNull
|
||||||
import io.reactivex.disposables.Disposable
|
|
||||||
import org.junit.Assert.fail
|
|
||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
@ -21,7 +18,7 @@ class MainActivityTest {
|
|||||||
fun login() {
|
fun login() {
|
||||||
val sut = activityRule.launchActivity(null)
|
val sut = activityRule.launchActivity(null)
|
||||||
|
|
||||||
sut.userManager.createOrUpdateUser(
|
val user = sut.userManager.createOrUpdateUser(
|
||||||
"test",
|
"test",
|
||||||
UserManager.UserAttributes(
|
UserManager.UserAttributes(
|
||||||
id = 0,
|
id = 0,
|
||||||
@ -35,20 +32,11 @@ class MainActivityTest {
|
|||||||
certificateAlias = null,
|
certificateAlias = null,
|
||||||
externalSignalingServer = null
|
externalSignalingServer = null
|
||||||
)
|
)
|
||||||
).subscribe(object : SingleObserver<User?> {
|
).blockingGet()
|
||||||
override fun onSubscribe(d: Disposable) {
|
|
||||||
// unused atm
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onSuccess(user: User) {
|
assertNotNull("Error creating user", user)
|
||||||
sut.runOnUiThread { sut.resetConversationsList() }
|
|
||||||
|
|
||||||
println("User: " + user.id + " / " + user.userId + " / " + user.baseUrl)
|
sut.runOnUiThread { sut.resetConversationsList() }
|
||||||
}
|
println("User: " + user!!.id + " / " + user.userId + " / " + user.baseUrl)
|
||||||
|
|
||||||
override fun onError(e: Throwable) {
|
|
||||||
fail("No user created")
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user