diff --git a/tests/integrational/asyncio/test_channel_groups.py b/tests/integrational/asyncio/test_channel_groups.py index 0d37da12..d87fecc9 100644 --- a/tests/integrational/asyncio/test_channel_groups.py +++ b/tests/integrational/asyncio/test_channel_groups.py @@ -4,7 +4,7 @@ from pubnub.models.consumer.channel_group import PNChannelGroupsAddChannelResult, PNChannelGroupsListResult, \ PNChannelGroupsRemoveChannelResult, PNChannelGroupsRemoveGroupResult from pubnub.pubnub_asyncio import PubNubAsyncio -from tests.helper import pnconf, pnconf_copy, pnconf_pam_copy +from tests.helper import pnconf, pnconf_copy, pnconf_pam_env_copy from tests.integrational.vcr_asyncio_sleeper import get_sleeper from tests.integrational.vcr_helper import pn_vcr @@ -137,7 +137,7 @@ async def test_add_channel_remove_group(event_loop, sleeper=asyncio.sleep): @pytest.mark.asyncio async def test_super_call(event_loop): - pubnub = PubNubAsyncio(pnconf_pam_copy(), custom_event_loop=event_loop) + pubnub = PubNubAsyncio(pnconf_pam_env_copy(), custom_event_loop=event_loop) ch = "channel-groups-torna|do-ch" gr = "channel-groups-torna|do-cg" diff --git a/tests/integrational/asyncio/test_heartbeat.py b/tests/integrational/asyncio/test_heartbeat.py index a66a284d..fc9ee423 100644 --- a/tests/integrational/asyncio/test_heartbeat.py +++ b/tests/integrational/asyncio/test_heartbeat.py @@ -5,16 +5,18 @@ import pubnub as pn from pubnub.pubnub_asyncio import PubNubAsyncio, SubscribeListener from tests import helper -from tests.helper import pnconf_sub_copy +from tests.helper import pnconf_env_copy pn.set_stream_logger('pubnub', logging.DEBUG) -messenger_config = pnconf_sub_copy() +messenger_config = pnconf_env_copy() messenger_config.set_presence_timeout(8) +messenger_config.enable_subscribe = True messenger_config.uuid = helper.gen_channel("messenger") -listener_config = pnconf_sub_copy() +listener_config = pnconf_env_copy() +listener_config.enable_subscribe = True listener_config.uuid = helper.gen_channel("listener") diff --git a/tests/integrational/asyncio/test_state.py b/tests/integrational/asyncio/test_state.py index 86ef7916..ea66cce6 100644 --- a/tests/integrational/asyncio/test_state.py +++ b/tests/integrational/asyncio/test_state.py @@ -5,7 +5,7 @@ from pubnub.models.consumer.presence import PNSetStateResult, PNGetStateResult from pubnub.pubnub_asyncio import PubNubAsyncio -from tests.helper import pnconf, pnconf_copy, pnconf_sub_copy, pnconf_pam_copy +from tests.helper import pnconf, pnconf_copy, pnconf_sub_copy, pnconf_pam_env_copy from tests.integrational.vcr_asyncio_sleeper import get_sleeper, VCR599Listener from tests.integrational.vcr_helper import pn_vcr @@ -118,7 +118,7 @@ async def test_multiple_channels(event_loop): @pytest.mark.asyncio async def test_state_super_admin_call(event_loop): - pnconf = pnconf_pam_copy() + pnconf = pnconf_pam_env_copy() pubnub = PubNubAsyncio(pnconf, custom_event_loop=event_loop) ch1 = 'test-state-asyncio-ch1' ch2 = 'test-state-asyncio-ch2' diff --git a/tests/integrational/native_sync/test_history.py b/tests/integrational/native_sync/test_history.py index a19b26f6..31d1585a 100644 --- a/tests/integrational/native_sync/test_history.py +++ b/tests/integrational/native_sync/test_history.py @@ -9,7 +9,7 @@ from pubnub.models.consumer.history import PNHistoryResult from pubnub.models.consumer.pubsub import PNPublishResult from pubnub.pubnub import PubNub -from tests.helper import pnconf_copy, pnconf_enc_copy, pnconf_pam_copy +from tests.helper import pnconf_copy, pnconf_enc_copy, pnconf_pam_env_copy from tests.integrational.vcr_helper import use_cassette_and_stub_time_sleep_native pubnub.set_stream_logger('pubnub', logging.DEBUG) @@ -79,7 +79,7 @@ def test_encrypted(self, crypto_mock): filter_query_parameters=['uuid', 'pnsdk']) def test_not_permitted(self): ch = "history-native-sync-ch" - pubnub = PubNub(pnconf_pam_copy()) + pubnub = PubNub(pnconf_pam_env_copy()) pubnub.config.uuid = "history-native-sync-uuid" with pytest.raises(PubNubException): @@ -87,7 +87,7 @@ def test_not_permitted(self): def test_super_call_with_channel_only(self): ch = "history-native-sync-ch" - pubnub = PubNub(pnconf_pam_copy()) + pubnub = PubNub(pnconf_pam_env_copy()) pubnub.config.uuid = "history-native-sync-uuid" envelope = pubnub.history().channel(ch).sync() @@ -97,7 +97,7 @@ def test_super_call_with_channel_only(self): def test_super_call_with_all_params(self): ch = "history-native-sync-ch" - pubnub = PubNub(pnconf_pam_copy()) + pubnub = PubNub(pnconf_pam_env_copy()) pubnub.config.uuid = "history-native-sync-uuid" envelope = pubnub.history().channel(ch).count(2).include_timetoken(True).reverse(True).start(1).end(2).sync() diff --git a/tests/integrational/native_sync/test_history_delete.py b/tests/integrational/native_sync/test_history_delete.py index 65067d2c..05c2453b 100644 --- a/tests/integrational/native_sync/test_history_delete.py +++ b/tests/integrational/native_sync/test_history_delete.py @@ -1,14 +1,14 @@ import unittest from pubnub.exceptions import PubNubException -from tests.helper import pnconf +from tests.helper import pnconf_env_copy from pubnub.pubnub import PubNub class TestPubNubHistoryDelete(unittest.TestCase): # pylint: disable=W0612 def test_success(self): try: - env = PubNub(pnconf).delete_messages() \ + env = PubNub(pnconf_env_copy()).delete_messages() \ .channel("my-ch") \ .start(123) \ .end(456) \ @@ -22,7 +22,7 @@ def test_success(self): def test_super_call(self): try: - env = PubNub(pnconf).delete_messages() \ + env = PubNub(pnconf_env_copy()).delete_messages() \ .channel("my-ch- |.* $") \ .start(123) \ .end(456) \ diff --git a/tests/integrational/native_sync/test_state.py b/tests/integrational/native_sync/test_state.py index d17b196d..353a4a81 100644 --- a/tests/integrational/native_sync/test_state.py +++ b/tests/integrational/native_sync/test_state.py @@ -4,7 +4,7 @@ import pubnub from pubnub.models.consumer.presence import PNSetStateResult, PNGetStateResult from pubnub.pubnub import PubNub -from tests.helper import pnconf_copy, pnconf_pam_copy +from tests.helper import pnconf_copy, pnconf_pam_env_copy from tests.integrational.vcr_helper import pn_vcr pubnub.set_stream_logger('pubnub', logging.DEBUG) @@ -57,7 +57,7 @@ def test_multiple_channels(self): def test_super_call(self): ch1 = "state-tornado-ch1" ch2 = "state-tornado-ch2" - pnconf = pnconf_pam_copy() + pnconf = pnconf_pam_env_copy() pubnub = PubNub(pnconf) pubnub.config.uuid = 'test-state-native-uuid-|.*$' state = {"name": "Alex", "count": 5} diff --git a/tests/integrational/native_threads/test_heartbeat.py b/tests/integrational/native_threads/test_heartbeat.py index f8bc977a..cd090955 100644 --- a/tests/integrational/native_threads/test_heartbeat.py +++ b/tests/integrational/native_threads/test_heartbeat.py @@ -5,18 +5,20 @@ from pubnub.pubnub import PubNub, SubscribeListener from tests import helper -from tests.helper import pnconf_sub_copy +from tests.helper import pnconf_env_copy pn.set_stream_logger('pubnub', logging.DEBUG) # TODO: add a success heartbeat test -messenger_config = pnconf_sub_copy() +messenger_config = pnconf_env_copy() messenger_config.set_presence_timeout(8) +messenger_config.enable_subscribe = True messenger_config.uuid = helper.gen_channel("messenger") -listener_config = pnconf_sub_copy() +listener_config = pnconf_env_copy() +listener_config.enable_subscribe = True listener_config.uuid = helper.gen_channel("listener") diff --git a/tests/integrational/native_threads/test_history_delete.py b/tests/integrational/native_threads/test_history_delete.py index 364cb83f..23028856 100644 --- a/tests/integrational/native_threads/test_history_delete.py +++ b/tests/integrational/native_threads/test_history_delete.py @@ -2,7 +2,7 @@ import threading from pubnub.pubnub import PubNub -from tests.helper import pnconf +from tests.helper import pnconf_env_copy class TestPubNubSuccessHistoryDelete(unittest.TestCase): # pylint: disable=W0612 @@ -23,7 +23,7 @@ def assert_success(self): self.status = None def test_success(self): - PubNub(pnconf).delete_messages() \ + PubNub(pnconf_env_copy()).delete_messages() \ .channel("my-ch") \ .start(123) \ .end(456) \ @@ -32,7 +32,7 @@ def test_success(self): self.assert_success() def test_super_call(self): - PubNub(pnconf).delete_messages() \ + PubNub(pnconf_env_copy()).delete_messages() \ .channel("my-ch- |.* $") \ .start(123) \ .end(456) \ diff --git a/tests/integrational/native_threads/test_publish.py b/tests/integrational/native_threads/test_publish.py index e2951cb9..17dd2035 100644 --- a/tests/integrational/native_threads/test_publish.py +++ b/tests/integrational/native_threads/test_publish.py @@ -6,7 +6,7 @@ from pubnub.models.consumer.pubsub import PNPublishResult from pubnub.pubnub import PubNub -from tests.helper import pnconf, pnconf_enc, pnconf_pam_copy, pnconf_copy +from tests.helper import pnconf_enc_env_copy, pnconf_pam_env_copy, pnconf_env_copy pubnub.set_stream_logger('pubnub', logging.DEBUG) @@ -31,7 +31,7 @@ def assert_success(self): self.status = None def assert_success_publish_get(self, msg): - PubNub(pnconf).publish() \ + PubNub(pnconf_env_copy()).publish() \ .channel("ch1") \ .message(msg) \ .pn_async(self.callback) @@ -39,7 +39,7 @@ def assert_success_publish_get(self, msg): self.assert_success() def assert_success_publish_post(self, msg): - PubNub(pnconf).publish() \ + PubNub(pnconf_env_copy()).publish() \ .channel("ch1") \ .message(msg) \ .use_post(True) \ @@ -62,7 +62,7 @@ def test_publish_post(self): self.assert_success_publish_post({"name": "Alex", "online": True}) def test_publish_encrypted_list_get(self): - pubnub = PubNub(pnconf_enc) + pubnub = PubNub(pnconf_enc_env_copy()) pubnub.publish() \ .channel("ch1") \ @@ -72,7 +72,7 @@ def test_publish_encrypted_list_get(self): self.assert_success() def test_publish_encrypted_string_get(self): - PubNub(pnconf_enc).publish() \ + PubNub(pnconf_enc_env_copy()).publish() \ .channel("ch1") \ .message("encrypted string") \ .pn_async(self.callback) @@ -80,7 +80,7 @@ def test_publish_encrypted_string_get(self): self.assert_success() def test_publish_encrypted_list_post(self): - PubNub(pnconf_enc).publish() \ + PubNub(pnconf_enc_env_copy()).publish() \ .channel("ch1") \ .message(["encrypted", "list"]) \ .use_post(True) \ @@ -89,7 +89,7 @@ def test_publish_encrypted_list_post(self): self.assert_success() def test_publish_encrypted_string_post(self): - PubNub(pnconf_enc).publish() \ + PubNub(pnconf_enc_env_copy()).publish() \ .channel("ch1") \ .message("encrypted string") \ .use_post(True) \ @@ -100,7 +100,7 @@ def test_publish_encrypted_string_post(self): def test_publish_with_meta(self): meta = {'a': 2, 'b': 'qwer'} - PubNub(pnconf_enc).publish() \ + PubNub(pnconf_enc_env_copy()).publish() \ .channel("ch1") \ .message("hey") \ .meta(meta) \ @@ -109,7 +109,7 @@ def test_publish_with_meta(self): self.assert_success() def test_publish_do_not_store(self): - PubNub(pnconf_enc).publish() \ + PubNub(pnconf_enc_env_copy()).publish() \ .channel("ch1") \ .message("hey") \ .should_store(False) \ @@ -129,7 +129,7 @@ def callback(self, response, status): def test_invalid_key(self): self.invalid_key_message = "" - pn_fake_key_config = pnconf_copy() + pn_fake_key_config = pnconf_env_copy() pn_fake_key_config.publish_key = "fake" PubNub(pn_fake_key_config).publish() \ @@ -147,7 +147,7 @@ def test_invalid_key(self): assert "Invalid Key" in str(self.status.error_data.exception) def test_missing_message(self): - PubNub(pnconf).publish() \ + PubNub(pnconf_env_copy()).publish() \ .channel("ch1") \ .message(None) \ .pn_async(self.callback) @@ -159,7 +159,7 @@ def test_missing_message(self): assert "Message missing" in str(self.status.error_data.exception) def test_missing_chanel(self): - PubNub(pnconf).publish() \ + PubNub(pnconf_env_copy()).publish() \ .channel("") \ .message("hey") \ .pn_async(self.callback) @@ -172,7 +172,7 @@ def test_non_serializable(self): def method(): pass - PubNub(pnconf).publish() \ + PubNub(pnconf_env_copy()).publish() \ .channel("ch1") \ .message(method) \ .pn_async(self.callback) @@ -184,7 +184,7 @@ def method(): assert "not JSON serializable" in str(self.status.error_data.exception) def test_not_permitted(self): - pnconf = pnconf_pam_copy() + pnconf = pnconf_pam_env_copy() pnconf.secret_key = None PubNub(pnconf).publish()\ diff --git a/tests/integrational/native_threads/test_subscribe.py b/tests/integrational/native_threads/test_subscribe.py index 59da1f86..8e7b88a0 100644 --- a/tests/integrational/native_threads/test_subscribe.py +++ b/tests/integrational/native_threads/test_subscribe.py @@ -8,7 +8,7 @@ from pubnub.models.consumer.pubsub import PNPublishResult, PNMessageResult from pubnub.pubnub import PubNub, SubscribeListener, NonSubscribeListener from tests import helper -from tests.helper import pnconf_sub_copy +from tests.helper import pnconf_sub_copy, pnconf_env_copy from tests.integrational.vcr_helper import pn_vcr @@ -50,8 +50,10 @@ def test_subscribe_unsubscribe(self): pubnub.stop() def test_subscribe_pub_unsubscribe(self): + conf = pnconf_env_copy() + conf.enable_subscribe = True ch = helper.gen_channel("test-subscribe-sub-pub-unsub") - pubnub = PubNub(pnconf_sub_copy()) + pubnub = PubNub(conf) subscribe_listener = SubscribeListener() publish_operation = NonSubscribeListener() message = "hey" @@ -87,9 +89,10 @@ def test_subscribe_pub_unsubscribe(self): def test_join_leave(self): ch = helper.gen_channel("test-subscribe-join-leave") - - pubnub = PubNub(pnconf_sub_copy()) - pubnub_listener = PubNub(pnconf_sub_copy()) + conf = pnconf_env_copy() + conf.enable_subscribe = True + pubnub = PubNub(conf) + pubnub_listener = PubNub(conf) callback_messages = SubscribeListener() callback_presence = SubscribeListener()