kopia lustrzana https://github.com/halcy/Mastodon.py
maybe remove monkey patch to make everything work fine by default
rodzic
c7837530a4
commit
73199e966a
|
@ -19,6 +19,8 @@ def vcr(vcr):
|
||||||
vcr.match_on = ['path']
|
vcr.match_on = ['path']
|
||||||
return vcr
|
return vcr
|
||||||
|
|
||||||
|
"""
|
||||||
|
# Needed for old vcrpy versions, but not amy more!
|
||||||
def patch_streaming():
|
def patch_streaming():
|
||||||
# For monkeypatching so we can make vcrpy better
|
# For monkeypatching so we can make vcrpy better
|
||||||
import vcr.stubs
|
import vcr.stubs
|
||||||
|
@ -52,6 +54,7 @@ def patch_streaming():
|
||||||
args[0].real_connection.getresponse = fakeRealConnectionGetresponse
|
args[0].real_connection.getresponse = fakeRealConnectionGetresponse
|
||||||
return real_get_response(*args, **kwargs)
|
return real_get_response(*args, **kwargs)
|
||||||
vcr.stubs.VCRConnection.getresponse = fake_get_response
|
vcr.stubs.VCRConnection.getresponse = fake_get_response
|
||||||
|
"""
|
||||||
|
|
||||||
def streaming_close():
|
def streaming_close():
|
||||||
global real_connections
|
global real_connections
|
||||||
|
@ -313,9 +316,7 @@ def test_multiline_payload():
|
||||||
assert listener.updates == [{"foo": "bar"}]
|
assert listener.updates == [{"foo": "bar"}]
|
||||||
|
|
||||||
@pytest.mark.vcr(match_on=['path'])
|
@pytest.mark.vcr(match_on=['path'])
|
||||||
def test_stream_user_direct(api, api2, api3):
|
def test_stream_user_direct(api, api2, api3):
|
||||||
patch_streaming()
|
|
||||||
|
|
||||||
# Make sure we are in the right state to not receive updates from api2
|
# Make sure we are in the right state to not receive updates from api2
|
||||||
user = api2.account_verify_credentials()
|
user = api2.account_verify_credentials()
|
||||||
api.account_unfollow(user)
|
api.account_unfollow(user)
|
||||||
|
@ -380,10 +381,7 @@ def test_stream_user_direct(api, api2, api3):
|
||||||
t.join()
|
t.join()
|
||||||
|
|
||||||
@pytest.mark.vcr(match_on=['path'])
|
@pytest.mark.vcr(match_on=['path'])
|
||||||
def test_stream_user_local(api, api2, vcr):
|
def test_stream_user_local(api, api2):
|
||||||
vcr.match_on = ["path"]
|
|
||||||
#patch_streaming()
|
|
||||||
|
|
||||||
# Make sure we are in the right state to not receive updates from api2
|
# Make sure we are in the right state to not receive updates from api2
|
||||||
user = api2.account_verify_credentials()
|
user = api2.account_verify_credentials()
|
||||||
api.account_unfollow(user)
|
api.account_unfollow(user)
|
||||||
|
@ -414,9 +412,7 @@ def test_stream_user_local(api, api2, vcr):
|
||||||
t.join()
|
t.join()
|
||||||
|
|
||||||
@pytest.mark.vcr(match_on=['path'])
|
@pytest.mark.vcr(match_on=['path'])
|
||||||
def test_stream_direct(api, api2):
|
def test_stream_direct(api, api2):
|
||||||
patch_streaming()
|
|
||||||
|
|
||||||
conversations = []
|
conversations = []
|
||||||
listener = CallbackStreamListener(
|
listener = CallbackStreamListener(
|
||||||
conversation_handler=conversations.append,
|
conversation_handler=conversations.append,
|
||||||
|
|
Ładowanie…
Reference in New Issue