Skip to content

Commit

Permalink
Changes after review
Browse files Browse the repository at this point in the history
  • Loading branch information
marcin-cebo committed Oct 18, 2024
1 parent 3aa133e commit 671407f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 24 deletions.
2 changes: 1 addition & 1 deletion pubnub-chat-api/pubnub_chat_api.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Pod::Spec.new do |spec|
spec.vendored_frameworks = 'build/cocoapods/framework/pubnub_chat_api.framework'
spec.libraries = 'c++'
spec.ios.deployment_target = '14'
spec.dependency 'PubNubSwift', '8.0.0'
spec.dependency 'PubNubSwift', '8.0.1'

if !Dir.exist?('build/cocoapods/framework/pubnub_chat_api.framework') || Dir.empty?('build/cocoapods/framework/pubnub_chat_api.framework')
raise "
Expand Down
2 changes: 1 addition & 1 deletion pubnub-chat-impl/pubnub_chat_impl.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Pod::Spec.new do |spec|
spec.vendored_frameworks = 'build/cocoapods/framework/pubnub_chat_impl.framework'
spec.libraries = 'c++'
spec.ios.deployment_target = '14'
spec.dependency 'PubNubSwift', '8.0.0'
spec.dependency 'PubNubSwift', '8.0.1'

if !Dir.exist?('build/cocoapods/framework/pubnub_chat_impl.framework') || Dir.empty?('build/cocoapods/framework/pubnub_chat_impl.framework')
raise "
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.pubnub.integration

import com.pubnub.api.PubNubException
import com.pubnub.api.models.consumer.access_manager.v3.ChannelGrant
import com.pubnub.api.models.consumer.access_manager.v3.UUIDGrant
import com.pubnub.api.v2.callbacks.Result
import com.pubnub.chat.Channel
import com.pubnub.chat.Event
import com.pubnub.chat.internal.message.MessageImpl
import com.pubnub.chat.listenForEvents
Expand All @@ -12,22 +11,16 @@ import com.pubnub.test.await
import kotlinx.coroutines.test.runTest
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith

class AccessManagerTest : BaseChatIntegrationTest() {
@Test
fun pubNubClient_with_PAM_enabled_should_not_getChannel_when_no_token_set() = runTest {
val channelId = channelPam.id
var statusCode = 0
val expectedStatusCode = 403 // Forbidden, no valid security Token provided
chatPamClient.getChannel(channelId).async { result: Result<Channel?> ->
result.onFailure { e ->
statusCode = e.statusCode
}.onSuccess { channel: Channel? ->
throw IllegalStateException("Should not enter here. Should return exception.")
}
}
delayInMillis(1000)
assertEquals(expectedStatusCode, statusCode)

val exception = assertFailsWith<PubNubException> { chatPamClient.getChannel(channelId).await() }
assertEquals(expectedStatusCode, exception.statusCode)
}

@Test
Expand All @@ -42,17 +35,9 @@ class AccessManagerTest : BaseChatIntegrationTest() {
// client uses token generated by server
chatPamClient.pubNub.setToken(token)

var actualChannelId: String? = ""
val token1 = chatPamClient.pubNub.getToken()
assertEquals(token1, token)
chatPamClient.getChannel(channelId).async { result: Result<Channel?> ->
result.onFailure {
throw IllegalStateException("Should not enter here. Should return channel.")
}.onSuccess { channel: Channel? ->
actualChannelId = channel?.id
}
}
delayInMillis(1000)
val actualChannelId = chatPamClient.getChannel(channelId).await()?.id
assertEquals(channelId, actualChannelId)

chatPamServer.deleteChannel(id = channelId).await()
Expand Down
2 changes: 1 addition & 1 deletion pubnub_chat.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Pod::Spec.new do |spec|
spec.vendored_frameworks = 'build/cocoapods/framework/PubNubChat.framework'
spec.libraries = 'c++'
spec.ios.deployment_target = '14'
spec.dependency 'PubNubSwift', '8.0.0'
spec.dependency 'PubNubSwift', '8.0.1'

if !Dir.exist?('build/cocoapods/framework/PubNubChat.framework') || Dir.empty?('build/cocoapods/framework/PubNubChat.framework')
raise "
Expand Down

0 comments on commit 671407f

Please sign in to comment.