|
|
@ -107,23 +107,23 @@ class TestAsyncAdmin: |
|
|
|
|
|
|
|
@with_instrumented_server(auth=False) |
|
|
|
def test_admin_connect_with_no_auth(self): |
|
|
|
with socketio.SimpleClient() as admin_client: |
|
|
|
with socketio.SimpleClient(reconnection=False) as admin_client: |
|
|
|
admin_client.connect('http://localhost:8900', namespace='/admin') |
|
|
|
with socketio.SimpleClient() as admin_client: |
|
|
|
with socketio.SimpleClient(reconnection=False) as admin_client: |
|
|
|
admin_client.connect('http://localhost:8900', namespace='/admin', |
|
|
|
auth={'foo': 'bar'}) |
|
|
|
|
|
|
|
@with_instrumented_server(auth={'foo': 'bar'}) |
|
|
|
def test_admin_connect_with_dict_auth(self): |
|
|
|
with socketio.SimpleClient() as admin_client: |
|
|
|
with socketio.SimpleClient(reconnection=False) as admin_client: |
|
|
|
admin_client.connect('http://localhost:8900', namespace='/admin', |
|
|
|
auth={'foo': 'bar'}) |
|
|
|
with socketio.SimpleClient() as admin_client: |
|
|
|
with socketio.SimpleClient(reconnection=False) as admin_client: |
|
|
|
with pytest.raises(ConnectionError): |
|
|
|
admin_client.connect( |
|
|
|
'http://localhost:8900', namespace='/admin', |
|
|
|
auth={'foo': 'baz'}) |
|
|
|
with socketio.SimpleClient() as admin_client: |
|
|
|
with socketio.SimpleClient(reconnection=False) as admin_client: |
|
|
|
with pytest.raises(ConnectionError): |
|
|
|
admin_client.connect( |
|
|
|
'http://localhost:8900', namespace='/admin') |
|
|
@ -131,52 +131,52 @@ class TestAsyncAdmin: |
|
|
|
@with_instrumented_server(auth=[{'foo': 'bar'}, |
|
|
|
{'u': 'admin', 'p': 'secret'}]) |
|
|
|
def test_admin_connect_with_list_auth(self): |
|
|
|
with socketio.SimpleClient() as admin_client: |
|
|
|
with socketio.SimpleClient(reconnection=False) as admin_client: |
|
|
|
admin_client.connect('http://localhost:8900', namespace='/admin', |
|
|
|
auth={'foo': 'bar'}) |
|
|
|
with socketio.SimpleClient() as admin_client: |
|
|
|
with socketio.SimpleClient(reconnection=False) as admin_client: |
|
|
|
admin_client.connect('http://localhost:8900', namespace='/admin', |
|
|
|
auth={'u': 'admin', 'p': 'secret'}) |
|
|
|
with socketio.SimpleClient() as admin_client: |
|
|
|
with socketio.SimpleClient(reconnection=False) as admin_client: |
|
|
|
with pytest.raises(ConnectionError): |
|
|
|
admin_client.connect('http://localhost:8900', |
|
|
|
namespace='/admin', auth={'foo': 'baz'}) |
|
|
|
with socketio.SimpleClient() as admin_client: |
|
|
|
with socketio.SimpleClient(reconnection=False) as admin_client: |
|
|
|
with pytest.raises(ConnectionError): |
|
|
|
admin_client.connect('http://localhost:8900', |
|
|
|
namespace='/admin') |
|
|
|
|
|
|
|
@with_instrumented_server(auth=_custom_auth) |
|
|
|
def test_admin_connect_with_function_auth(self): |
|
|
|
with socketio.SimpleClient() as admin_client: |
|
|
|
with socketio.SimpleClient(reconnection=False) as admin_client: |
|
|
|
admin_client.connect('http://localhost:8900', namespace='/admin', |
|
|
|
auth={'foo': 'bar'}) |
|
|
|
with socketio.SimpleClient() as admin_client: |
|
|
|
with socketio.SimpleClient(reconnection=False) as admin_client: |
|
|
|
with pytest.raises(ConnectionError): |
|
|
|
admin_client.connect('http://localhost:8900', |
|
|
|
namespace='/admin', auth={'foo': 'baz'}) |
|
|
|
with socketio.SimpleClient() as admin_client: |
|
|
|
with socketio.SimpleClient(reconnection=False) as admin_client: |
|
|
|
with pytest.raises(ConnectionError): |
|
|
|
admin_client.connect('http://localhost:8900', |
|
|
|
namespace='/admin') |
|
|
|
|
|
|
|
@with_instrumented_server(auth=_async_custom_auth) |
|
|
|
def test_admin_connect_with_async_function_auth(self): |
|
|
|
with socketio.SimpleClient() as admin_client: |
|
|
|
with socketio.SimpleClient(reconnection=False) as admin_client: |
|
|
|
admin_client.connect('http://localhost:8900', namespace='/admin', |
|
|
|
auth={'foo': 'bar'}) |
|
|
|
with socketio.SimpleClient() as admin_client: |
|
|
|
with socketio.SimpleClient(reconnection=False) as admin_client: |
|
|
|
with pytest.raises(ConnectionError): |
|
|
|
admin_client.connect('http://localhost:8900', |
|
|
|
namespace='/admin', auth={'foo': 'baz'}) |
|
|
|
with socketio.SimpleClient() as admin_client: |
|
|
|
with socketio.SimpleClient(reconnection=False) as admin_client: |
|
|
|
with pytest.raises(ConnectionError): |
|
|
|
admin_client.connect('http://localhost:8900', |
|
|
|
namespace='/admin') |
|
|
|
|
|
|
|
@with_instrumented_server() |
|
|
|
def test_admin_connect_only_admin(self): |
|
|
|
with socketio.SimpleClient() as admin_client: |
|
|
|
with socketio.SimpleClient(reconnection=False) as admin_client: |
|
|
|
admin_client.connect('http://localhost:8900', namespace='/admin') |
|
|
|
sid = admin_client.sid |
|
|
|
events = self._expect({'config': 1, 'all_sockets': 1, |
|
|
@ -201,10 +201,10 @@ class TestAsyncAdmin: |
|
|
|
|
|
|
|
@with_instrumented_server() |
|
|
|
def test_admin_connect_with_others(self): |
|
|
|
with socketio.SimpleClient() as client1, \ |
|
|
|
socketio.SimpleClient() as client2, \ |
|
|
|
socketio.SimpleClient() as client3, \ |
|
|
|
socketio.SimpleClient() as admin_client: |
|
|
|
with socketio.SimpleClient(reconnection=False) as client1, \ |
|
|
|
socketio.SimpleClient(reconnection=False) as client2, \ |
|
|
|
socketio.SimpleClient(reconnection=False) as client3, \ |
|
|
|
socketio.SimpleClient(reconnection=False) as admin_client: |
|
|
|
client1.connect('http://localhost:8900') |
|
|
|
client1.emit('enter_room', 'room') |
|
|
|
sid1 = client1.sid |
|
|
@ -251,7 +251,7 @@ class TestAsyncAdmin: |
|
|
|
|
|
|
|
@with_instrumented_server(mode='production', read_only=True) |
|
|
|
def test_admin_connect_production(self): |
|
|
|
with socketio.SimpleClient() as admin_client: |
|
|
|
with socketio.SimpleClient(reconnection=False) as admin_client: |
|
|
|
admin_client.connect('http://localhost:8900', namespace='/admin') |
|
|
|
events = self._expect({'config': 1, 'server_stats': 2}, |
|
|
|
admin_client) |
|
|
@ -272,9 +272,9 @@ class TestAsyncAdmin: |
|
|
|
|
|
|
|
@with_instrumented_server() |
|
|
|
def test_admin_features(self): |
|
|
|
with socketio.SimpleClient() as client1, \ |
|
|
|
socketio.SimpleClient() as client2, \ |
|
|
|
socketio.SimpleClient() as admin_client: |
|
|
|
with socketio.SimpleClient(reconnection=False) as client1, \ |
|
|
|
socketio.SimpleClient(reconnection=False) as client2, \ |
|
|
|
socketio.SimpleClient(reconnection=False) as admin_client: |
|
|
|
client1.connect('http://localhost:8900') |
|
|
|
client2.connect('http://localhost:8900') |
|
|
|
admin_client.connect('http://localhost:8900', namespace='/admin') |
|
|
|