Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""
shark = SocketShark(TEST_CONFIG)
client = MockClient(shark)
session = client.session
await session.on_client_event({'event': 'auth', 'method': 'x'})
assert client.log.pop() == {
'status': 'error',
'event': 'auth',
'error': c.ERR_AUTH_UNSUPPORTED,
}
no_auth_config = TEST_CONFIG.copy()
no_auth_config['AUTHENTICATION'] = {}
shark = SocketShark(no_auth_config)
session = Session(shark, client)
await session.on_client_event({'event': 'auth', 'method': 'ticket'})
assert client.log.pop() == {
'status': 'error',
'event': 'auth',
'error': c.ERR_AUTH_UNSUPPORTED,
}
assert not client.log
def __init__(self, shark):
self.log = []
self.session = Session(shark, self)
def __init__(self, shark, websocket):
self.websocket = websocket
self.session = Session(shark, self, info={
'remote': websocket.remote_address,
})
self.shark = shark