mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-12-18 14:42:16 +03:00
fix(detekt): shorten test method by extracting conversation object creation
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
720fdda005
commit
5011649499
1 changed files with 28 additions and 24 deletions
|
@ -21,7 +21,34 @@ class ParticipantPermissionsTest : TestCase() {
|
|||
@Test
|
||||
fun test_areFlagsSet() {
|
||||
val spreedCapability = SpreedCapability()
|
||||
val conversation = Conversation(
|
||||
val conversation = createConversation()
|
||||
|
||||
conversation.permissions = ParticipantPermissions.PUBLISH_SCREEN or
|
||||
ParticipantPermissions.JOIN_CALL or
|
||||
ParticipantPermissions.DEFAULT
|
||||
|
||||
val user = User()
|
||||
user.id = 1
|
||||
|
||||
val attendeePermissions =
|
||||
ParticipantPermissions(
|
||||
spreedCapability,
|
||||
ConversationModel.mapToConversationModel(conversation, user)
|
||||
)
|
||||
|
||||
assert(attendeePermissions.canPublishScreen)
|
||||
assert(attendeePermissions.canJoinCall)
|
||||
assert(attendeePermissions.isDefault)
|
||||
|
||||
assertFalse(attendeePermissions.isCustom)
|
||||
assertFalse(attendeePermissions.canStartCall())
|
||||
assertFalse(attendeePermissions.canIgnoreLobby())
|
||||
assertTrue(attendeePermissions.canPublishAudio())
|
||||
assertTrue(attendeePermissions.canPublishVideo())
|
||||
}
|
||||
|
||||
private fun createConversation(): Conversation {
|
||||
return Conversation(
|
||||
token = "test",
|
||||
name = "test",
|
||||
displayName = "test",
|
||||
|
@ -67,28 +94,5 @@ class ParticipantPermissionsTest : TestCase() {
|
|||
remoteServer = "",
|
||||
remoteToken = ""
|
||||
)
|
||||
|
||||
conversation.permissions = ParticipantPermissions.PUBLISH_SCREEN or
|
||||
ParticipantPermissions.JOIN_CALL or
|
||||
ParticipantPermissions.DEFAULT
|
||||
|
||||
val user = User()
|
||||
user.id = 1
|
||||
|
||||
val attendeePermissions =
|
||||
ParticipantPermissions(
|
||||
spreedCapability,
|
||||
ConversationModel.mapToConversationModel(conversation, user)
|
||||
)
|
||||
|
||||
assert(attendeePermissions.canPublishScreen)
|
||||
assert(attendeePermissions.canJoinCall)
|
||||
assert(attendeePermissions.isDefault)
|
||||
|
||||
assertFalse(attendeePermissions.isCustom)
|
||||
assertFalse(attendeePermissions.canStartCall())
|
||||
assertFalse(attendeePermissions.canIgnoreLobby())
|
||||
assertTrue(attendeePermissions.canPublishAudio())
|
||||
assertTrue(attendeePermissions.canPublishVideo())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue