Skip to content

Commit

Permalink
Added tests for access manager.
Browse files Browse the repository at this point in the history
  • Loading branch information
marcin-cebo committed Jan 20, 2025
1 parent de31640 commit 3036292
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,15 @@ class AccessManagerTest : BaseChatIntegrationTest() {
chatPamServer.createChannel(id = channelId).await()
val token = chatPamServer.pubNub.grantToken(
ttl = 1,
channels = listOf(ChannelGrant.name(get = true, name = channelId, read = true, write = true, manage = true)) // get = true
channels = listOf(
ChannelGrant.name(
get = true,
name = channelId,
read = true,
write = true,
manage = true
)
) // get = true
).await().token
// client uses token generated by server
chatPamClient.pubNub.setToken(token)
Expand Down Expand Up @@ -136,6 +144,9 @@ class AccessManagerTest : BaseChatIntegrationTest() {
}

private suspend fun generateToken(chat: Chat, channelId: String, ttl: Int): String {
return chat.pubNub.grantToken(ttl = ttl, channels = listOf(ChannelGrant.name(get = true, name = channelId, read = true, write = true, manage = true))).await().token
return chat.pubNub.grantToken(
ttl = ttl,
channels = listOf(ChannelGrant.name(get = true, name = channelId, read = true, write = true, manage = true))
).await().token
}
}

0 comments on commit 3036292

Please sign in to comment.