99from  pubnub .models .consumer .common  import  PNStatus 
1010from  pubnub .models .consumer .pubsub  import  PNPublishResult 
1111from  pubnub .pubnub_asyncio  import  PubNubAsyncio , AsyncioEnvelope , PubNubAsyncioException 
12- from  tests .helper  import  pnconf_copy ,  pnconf_enc_copy ,  pnconf_pam_copy 
12+ from  tests .helper  import  pnconf_enc_env_copy ,  pnconf_pam_env_copy ,  pnconf_env_copy 
1313from  tests .integrational .vcr_helper  import  pn_vcr 
1414
1515pn .set_stream_logger ('pubnub' , logging .DEBUG )
@@ -47,12 +47,12 @@ async def assert_success_publish_post(pubnub, msg):
4747
4848
4949@pn_vcr .use_cassette ( 
50-     'tests/integrational/fixtures/asyncio/publish/mixed_via_get.yaml ' , 
51-     filter_query_parameters = ['uuid' , 'seqn' , 'pnsdk' ] 
50+     'tests/integrational/fixtures/asyncio/publish/mixed_via_get.json'  ,  serializer = 'pn_json ' 
51+     filter_query_parameters = ['uuid' , 'seqn' , 'pnsdk' ,  'l_pub' ] 
5252) 
5353@pytest .mark .asyncio  
5454async  def  test_publish_mixed_via_get (event_loop ):
55-     pubnub  =  PubNubAsyncio (pnconf_copy (), custom_event_loop = event_loop )
55+     pubnub  =  PubNubAsyncio (pnconf_env_copy (), custom_event_loop = event_loop )
5656    await  asyncio .gather (
5757        asyncio .ensure_future (assert_success_publish_get (pubnub , "hi" )),
5858        asyncio .ensure_future (assert_success_publish_get (pubnub , 5 )),
@@ -64,24 +64,24 @@ async def test_publish_mixed_via_get(event_loop):
6464
6565
6666@pn_vcr .use_cassette ( 
67-     'tests/integrational/fixtures/asyncio/publish/object_via_get.yaml ' , 
67+     'tests/integrational/fixtures/asyncio/publish/object_via_get.json'  ,  serializer = 'pn_json ' 
6868    filter_query_parameters = ['uuid' , 'seqn' , 'pnsdk' ], 
6969    match_on = ['method' , 'scheme' , 'host' , 'port' , 'object_in_path' , 'query' ] 
7070) 
7171@pytest .mark .asyncio  
7272async  def  test_publish_object_via_get (event_loop ):
73-     pubnub  =  PubNubAsyncio (pnconf_copy (), custom_event_loop = event_loop )
73+     pubnub  =  PubNubAsyncio (pnconf_env_copy (), custom_event_loop = event_loop )
7474    await  asyncio .ensure_future (assert_success_publish_get (pubnub , {"name" : "Alex" , "online" : True }))
7575
7676    await  pubnub .stop ()
7777
7878
7979@pn_vcr .use_cassette ( 
80-     'tests/integrational/fixtures/asyncio/publish/mixed_via_post.yaml ' , 
81-     filter_query_parameters = ['uuid' , 'seqn' , 'pnsdk' ]) 
80+     'tests/integrational/fixtures/asyncio/publish/mixed_via_post.json'  ,  serializer = 'pn_json ' 
81+     filter_query_parameters = ['uuid' , 'seqn' , 'pnsdk' ,  'l_pub' ]) 
8282@pytest .mark .asyncio  
8383async  def  test_publish_mixed_via_post (event_loop ):
84-     pubnub  =  PubNubAsyncio (pnconf_copy (), custom_event_loop = event_loop )
84+     pubnub  =  PubNubAsyncio (pnconf_env_copy (), custom_event_loop = event_loop )
8585    await  asyncio .gather (
8686        asyncio .ensure_future (assert_success_publish_post (pubnub , "hi" )),
8787        asyncio .ensure_future (assert_success_publish_post (pubnub , 5 )),
@@ -92,24 +92,24 @@ async def test_publish_mixed_via_post(event_loop):
9292
9393
9494@pn_vcr .use_cassette ( 
95-     'tests/integrational/fixtures/asyncio/publish/object_via_post.yaml ' , 
95+     'tests/integrational/fixtures/asyncio/publish/object_via_post.json'  ,  serializer = 'pn_json ' 
9696    filter_query_parameters = ['uuid' , 'seqn' , 'pnsdk' ], 
9797    match_on = ['method' , 'scheme' , 'host' , 'port' , 'path' , 'query' , 'object_in_body' ]) 
9898@pytest .mark .asyncio  
9999async  def  test_publish_object_via_post (event_loop ):
100-     pubnub  =  PubNubAsyncio (pnconf_copy (), custom_event_loop = event_loop )
100+     pubnub  =  PubNubAsyncio (pnconf_env_copy (), custom_event_loop = event_loop )
101101    await  asyncio .ensure_future (assert_success_publish_post (pubnub , {"name" : "Alex" , "online" : True }))
102102
103103    await  pubnub .stop ()
104104
105105
106106@pn_vcr .use_cassette ( 
107-     'tests/integrational/fixtures/asyncio/publish/mixed_via_get_encrypted.yaml ' , 
108-     filter_query_parameters = ['uuid' , 'seqn' , 'pnsdk' ]) 
107+     'tests/integrational/fixtures/asyncio/publish/mixed_via_get_encrypted.json'  ,  serializer = 'pn_json ' 
108+     filter_query_parameters = ['uuid' , 'seqn' , 'pnsdk' ,  'l_pub' ]) 
109109@pytest .mark .asyncio  
110110async  def  test_publish_mixed_via_get_encrypted (event_loop ):
111111    with  patch ("pubnub.crypto.PubNubCryptodome.get_initialization_vector" , return_value = "knightsofni12345" ):
112-         pubnub  =  PubNubAsyncio (pnconf_enc_copy (), custom_event_loop = event_loop )
112+         pubnub  =  PubNubAsyncio (pnconf_enc_env_copy (), custom_event_loop = event_loop )
113113        await  asyncio .gather (
114114            asyncio .ensure_future (assert_success_publish_get (pubnub , "hi" )),
115115            asyncio .ensure_future (assert_success_publish_get (pubnub , 5 )),
@@ -120,28 +120,28 @@ async def test_publish_mixed_via_get_encrypted(event_loop):
120120
121121
122122@pn_vcr .use_cassette ( 
123-     'tests/integrational/fixtures/asyncio/publish/object_via_get_encrypted.yaml ' , 
123+     'tests/integrational/fixtures/asyncio/publish/object_via_get_encrypted.json'  ,  serializer = 'pn_json ' 
124124    filter_query_parameters = ['uuid' , 'seqn' , 'pnsdk' ], 
125125    match_on = ['host' , 'method' , 'query' ] 
126126) 
127127@pytest .mark .asyncio  
128128async  def  test_publish_object_via_get_encrypted (event_loop ):
129129    with  patch ("pubnub.crypto.PubNubCryptodome.get_initialization_vector" , return_value = "knightsofni12345" ):
130-         pubnub  =  PubNubAsyncio (pnconf_enc_copy (), custom_event_loop = event_loop )
130+         pubnub  =  PubNubAsyncio (pnconf_enc_env_copy (), custom_event_loop = event_loop )
131131        await  asyncio .ensure_future (assert_success_publish_get (pubnub , {"name" : "Alex" , "online" : True }))
132132
133133    await  pubnub .stop ()
134134
135135
136136@pn_vcr .use_cassette ( 
137-     'tests/integrational/fixtures/asyncio/publish/mixed_via_post_encrypted.yaml ' , 
138-     filter_query_parameters = ['uuid' , 'seqn' , 'pnsdk' ], 
137+     'tests/integrational/fixtures/asyncio/publish/mixed_via_post_encrypted.json'  ,  serializer = 'pn_json ' 
138+     filter_query_parameters = ['uuid' , 'seqn' , 'pnsdk' ,  'l_pub' ], 
139139    match_on = ['method' , 'path' , 'query' , 'body' ] 
140140) 
141141@pytest .mark .asyncio  
142142async  def  test_publish_mixed_via_post_encrypted (event_loop ):
143143    with  patch ("pubnub.crypto.PubNubCryptodome.get_initialization_vector" , return_value = "knightsofni12345" ):
144-         pubnub  =  PubNubAsyncio (pnconf_enc_copy (), custom_event_loop = event_loop )
144+         pubnub  =  PubNubAsyncio (pnconf_enc_env_copy (), custom_event_loop = event_loop )
145145        await  asyncio .gather (
146146            asyncio .ensure_future (assert_success_publish_post (pubnub , "hi" )),
147147            asyncio .ensure_future (assert_success_publish_post (pubnub , 5 )),
@@ -153,38 +153,38 @@ async def test_publish_mixed_via_post_encrypted(event_loop):
153153
154154
155155@pn_vcr .use_cassette ( 
156-     'tests/integrational/fixtures/asyncio/publish/object_via_post_encrypted.yaml ' , 
156+     'tests/integrational/fixtures/asyncio/publish/object_via_post_encrypted.json'  ,  serializer = 'pn_json ' 
157157    filter_query_parameters = ['uuid' , 'seqn' , 'pnsdk' ], 
158158    match_on = ['method' , 'path' , 'query' ] 
159159) 
160160@pytest .mark .asyncio  
161161async  def  test_publish_object_via_post_encrypted (event_loop ):
162162    with  patch ("pubnub.crypto.PubNubCryptodome.get_initialization_vector" , return_value = "knightsofni12345" ):
163-         pubnub  =  PubNubAsyncio (pnconf_enc_copy (), custom_event_loop = event_loop )
163+         pubnub  =  PubNubAsyncio (pnconf_enc_env_copy (), custom_event_loop = event_loop )
164164        await  asyncio .ensure_future (assert_success_publish_post (pubnub , {"name" : "Alex" , "online" : True }))
165165
166166    await  pubnub .stop ()
167167
168168
169169@pytest .mark .asyncio  
170170async  def  test_error_missing_message (event_loop ):
171-     pubnub  =  PubNubAsyncio (pnconf_copy (), custom_event_loop = event_loop )
171+     pubnub  =  PubNubAsyncio (pnconf_env_copy (), custom_event_loop = event_loop )
172172    await  assert_client_side_error (pubnub .publish ().channel (ch ).message (None ), "Message missing" )
173173
174174    await  pubnub .stop ()
175175
176176
177177@pytest .mark .asyncio  
178178async  def  test_error_missing_channel (event_loop ):
179-     pubnub  =  PubNubAsyncio (pnconf_copy (), custom_event_loop = event_loop )
179+     pubnub  =  PubNubAsyncio (pnconf_env_copy (), custom_event_loop = event_loop )
180180    await  assert_client_side_error (pubnub .publish ().channel ("" ).message ("hey" ), "Channel missing" )
181181
182182    await  pubnub .stop ()
183183
184184
185185@pytest .mark .asyncio  
186186async  def  test_error_non_serializable (event_loop ):
187-     pubnub  =  PubNubAsyncio (pnconf_copy (), custom_event_loop = event_loop )
187+     pubnub  =  PubNubAsyncio (pnconf_env_copy (), custom_event_loop = event_loop )
188188
189189    def  method ():
190190        pass 
@@ -194,23 +194,23 @@ def method():
194194
195195
196196@pn_vcr .use_cassette ( 
197-     'tests/integrational/fixtures/asyncio/publish/meta_object.yaml ' , 
197+     'tests/integrational/fixtures/asyncio/publish/meta_object.json'  ,  serializer = 'pn_json ' 
198198    filter_query_parameters = ['uuid' , 'seqn' , 'pnsdk' ], 
199199    match_on = ['host' , 'method' , 'path' , 'meta_object_in_query' ]) 
200200@pytest .mark .asyncio  
201201async  def  test_publish_with_meta (event_loop ):
202-     pubnub  =  PubNubAsyncio (pnconf_copy (), custom_event_loop = event_loop )
202+     pubnub  =  PubNubAsyncio (pnconf_env_copy (), custom_event_loop = event_loop )
203203
204204    await  assert_success_await (pubnub .publish ().channel (ch ).message ("hey" ).meta ({'a' : 2 , 'b' : 'qwer' }))
205205    await  pubnub .stop ()
206206
207207
208208@pn_vcr .use_cassette ( 
209-     'tests/integrational/fixtures/asyncio/publish/do_not_store.yaml ' , 
209+     'tests/integrational/fixtures/asyncio/publish/do_not_store.json'  ,  serializer = 'pn_json ' 
210210    filter_query_parameters = ['uuid' , 'seqn' , 'pnsdk' ]) 
211211@pytest .mark .asyncio  
212212async  def  test_publish_do_not_store (event_loop ):
213-     pubnub  =  PubNubAsyncio (pnconf_copy (), custom_event_loop = event_loop )
213+     pubnub  =  PubNubAsyncio (pnconf_env_copy (), custom_event_loop = event_loop )
214214
215215    await  assert_success_await (pubnub .publish ().channel (ch ).message ("hey" ).should_store (False ))
216216    await  pubnub .stop ()
@@ -225,11 +225,11 @@ async def assert_server_side_error_yield(pub, expected_err_msg):
225225
226226
227227@pn_vcr .use_cassette ( 
228-     'tests/integrational/fixtures/asyncio/publish/invalid_key.yaml ' , 
228+     'tests/integrational/fixtures/asyncio/publish/invalid_key.json'  ,  serializer = 'pn_json ' 
229229    filter_query_parameters = ['uuid' , 'seqn' , 'pnsdk' ]) 
230230@pytest .mark .asyncio  
231231async  def  test_error_invalid_key (event_loop ):
232-     pnconf  =  pnconf_pam_copy ()
232+     pnconf  =  pnconf_pam_env_copy ()
233233
234234    pubnub  =  PubNubAsyncio (pnconf , custom_event_loop = event_loop )
235235
@@ -238,11 +238,11 @@ async def test_error_invalid_key(event_loop):
238238
239239
240240@pn_vcr .use_cassette ( 
241-     'tests/integrational/fixtures/asyncio/publish/not_permitted.yaml ' , 
241+     'tests/integrational/fixtures/asyncio/publish/not_permitted.json'  ,  serializer = 'pn_json ' 
242242    filter_query_parameters = ['uuid' , 'seqn' , 'signature' , 'timestamp' , 'pnsdk' ]) 
243243@pytest .mark .asyncio  
244244async  def  test_not_permitted (event_loop ):
245-     pnconf  =  pnconf_pam_copy ()
245+     pnconf  =  pnconf_pam_env_copy ()
246246    pnconf .secret_key  =  None 
247247    pubnub  =  PubNubAsyncio (pnconf , custom_event_loop = event_loop )
248248
@@ -252,7 +252,7 @@ async def test_not_permitted(event_loop):
252252
253253@pytest .mark .asyncio  
254254async  def  test_publish_super_admin_call (event_loop ):
255-     pubnub  =  PubNubAsyncio (pnconf_pam_copy (), custom_event_loop = event_loop )
255+     pubnub  =  PubNubAsyncio (pnconf_pam_env_copy (), custom_event_loop = event_loop )
256256
257257    await  pubnub .publish ().channel (ch ).message ("hey" ).future ()
258258    await  pubnub .publish ().channel ("f#!|oo.bar" ).message ("hey^&#$" ).should_store (True ).meta ({
0 commit comments