mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-22 21:19:31 +01: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
@ -21,7 +21,34 @@ class ParticipantPermissionsTest : TestCase() {
|
|||||||
@Test
|
@Test
|
||||||
fun test_areFlagsSet() {
|
fun test_areFlagsSet() {
|
||||||
val spreedCapability = SpreedCapability()
|
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",
|
token = "test",
|
||||||
name = "test",
|
name = "test",
|
||||||
displayName = "test",
|
displayName = "test",
|
||||||
@ -67,28 +94,5 @@ class ParticipantPermissionsTest : TestCase() {
|
|||||||
remoteServer = "",
|
remoteServer = "",
|
||||||
remoteToken = ""
|
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 New Issue
Block a user