def test_remove_connection_w_presence(self, test_uuids): server_state = get_state() user = User("test_user") server_state.users[user.username] = user connection = Connection("test_user", conn_id=test_uuids[1]) user.add_connection(connection) config = {"notify_presence": True, "broadcast_presence_with_user_lists": True} channel = Channel("test", channel_config=config) channel.add_connection(connection) channel.remove_connection(connection)
def test_remove_connection_w_presence(self, test_uuids): server_state = get_state() user = User("test_user") server_state.users[user.username] = user connection = Connection("test_user", conn_id=test_uuids[1]) user.add_connection(connection) config = { "notify_presence": True, "broadcast_presence_with_user_lists": True } channel = Channel("test", channel_config=config) channel.add_connection(connection) channel.remove_connection(connection)
def test_remove_connection(self, test_uuids): connection = Connection("test_user", conn_id=test_uuids[1]) connection2 = Connection("test_user2", conn_id=test_uuids[2]) connection3 = Connection("test_user", conn_id=test_uuids[3]) channel = Channel("test") channel.add_connection(connection) channel.add_connection(connection2) channel.remove_connection(connection) assert "test_user" not in channel.connections assert len(channel.connections["test_user2"]) == 1 channel.add_connection(connection) channel.add_connection(connection3) channel.remove_connection(connection) assert len(channel.connections["test_user"]) == 1
def test_remove_connection(self, test_uuids): connection = Connection("test_user", conn_id=test_uuids[1]) connection2 = Connection("test_user2", conn_id=test_uuids[2]) connection3 = Connection("test_user", conn_id=test_uuids[3]) channel = Channel("test") channel.add_connection(connection) channel.add_connection(connection2) channel.remove_connection(connection) assert "test_user" not in channel.connections assert len(channel.connections["test_user2"]) == 1 channel.add_connection(connection) channel.add_connection(connection3) channel.remove_connection(connection) assert len(channel.connections["test_user"]) == 1
def test_remove_non_existant_connection(self, test_uuids): channel = Channel("test") connection = Connection("test_user", conn_id=test_uuids[1]) channel.remove_connection(connection) assert "test_user" not in channel.connections
def test_remove_non_existant_connection(self, test_uuids): channel = Channel("test") connection = Connection("test_user", conn_id=test_uuids[1]) channel.remove_connection(connection) assert "test_user" not in channel.connections