@@ -877,13 +877,11 @@ async def test_client_update_state_params(
877
877
assert getattr (indego , attr ) == assert_value
878
878
879
879
@pytest .mark .parametrize (
880
- "sync, func, param, attr, initial_ret_value, updated_ret_value, initial_assert_value, updated_assert_value" ,
880
+ "sync, func, initial_ret_value, updated_ret_value, initial_assert_value, updated_assert_value" ,
881
881
[
882
882
(
883
883
True ,
884
884
IndegoClient .update_state ,
885
- {"longpoll" : True },
886
- "state" ,
887
885
STATE_RESPONSE ,
888
886
None , # No update / empty response
889
887
State (** STATE_RESPONSE ),
@@ -892,8 +890,6 @@ async def test_client_update_state_params(
892
890
(
893
891
True ,
894
892
IndegoClient .update_state ,
895
- {"longpoll" : True },
896
- "state" ,
897
893
STATE_RESPONSE ,
898
894
None , # No update / empty response
899
895
State (** STATE_RESPONSE ),
@@ -902,8 +898,6 @@ async def test_client_update_state_params(
902
898
(
903
899
False ,
904
900
IndegoAsyncClient .update_state ,
905
- {"longpoll" : True },
906
- "state" ,
907
901
STATE_RESPONSE ,
908
902
STATE_UPDATE_RESPONSE ,
909
903
State (** STATE_RESPONSE ),
@@ -912,8 +906,6 @@ async def test_client_update_state_params(
912
906
(
913
907
False ,
914
908
IndegoAsyncClient .update_state ,
915
- {"longpoll" : True },
916
- "state" ,
917
909
STATE_RESPONSE ,
918
910
STATE_UPDATE_RESPONSE ,
919
911
State (** STATE_RESPONSE ),
@@ -923,7 +915,7 @@ async def test_client_update_state_params(
923
915
)
924
916
@pytest .mark .asyncio
925
917
async def test_state_long_poll_updates (
926
- self , sync , func , param , attr , initial_ret_value , updated_ret_value , initial_assert_value , updated_assert_value
918
+ self , sync , func , initial_ret_value , updated_ret_value , initial_assert_value , updated_assert_value
927
919
):
928
920
"""Test a state update using longpoll and make sure the state of correctly merged."""
929
921
if sync :
@@ -932,14 +924,14 @@ async def test_state_long_poll_updates(
932
924
# Initial update with changes.
933
925
resp = MockResponseSync (initial_ret_value , 200 )
934
926
with patch ("requests.request" , return_value = resp ):
935
- func (indego , ** param )
936
- assert getattr (indego , attr ) == initial_assert_value
927
+ func (indego , longpoll = True , longpoll_timeout = 10 )
928
+ assert getattr (indego , "state" ) == initial_assert_value
937
929
938
930
# 2nd update, state should be merged with previous update.
939
931
resp = MockResponseSync (updated_ret_value , 504 if updated_ret_value is None else 200 )
940
932
with patch ("requests.request" , return_value = resp ):
941
- func (indego , ** param )
942
- assert getattr (indego , attr ) == updated_assert_value
933
+ func (indego , longpoll = True , longpoll_timeout = 10 )
934
+ assert getattr (indego , "state" ) == updated_assert_value
943
935
944
936
else :
945
937
async with IndegoAsyncClient (** test_config ) as indego :
@@ -948,16 +940,16 @@ async def test_state_long_poll_updates(
948
940
with patch ("aiohttp.ClientSession.request" , return_value = resp ), patch (
949
941
"pyIndego.IndegoAsyncClient.start" , return_value = True
950
942
):
951
- await func (indego , ** param )
952
- assert getattr (indego , attr ) == initial_assert_value
943
+ await func (indego , longpoll = True , longpoll_timeout = 10 )
944
+ assert getattr (indego , "state" ) == initial_assert_value
953
945
954
946
# 2nd update, state should be merged with previous update.
955
947
resp = MockResponseAsync (updated_ret_value , 504 if updated_ret_value is None else 200 )
956
948
with patch ("aiohttp.ClientSession.request" , return_value = resp ), patch (
957
949
"pyIndego.IndegoAsyncClient.start" , return_value = True
958
950
):
959
- await func (indego , ** param )
960
- assert getattr (indego , attr ) == updated_assert_value
951
+ await func (indego , longpoll = True , longpoll_timeout = 10 )
952
+ assert getattr (indego , "state" ) == updated_assert_value
961
953
962
954
@pytest .mark .parametrize (
963
955
"sync, func, attr, ret_value, assert_value" ,
0 commit comments