def join_collaborator_to_room(self, u_id, p_id): """ json has: - u_id: user id(collaborator's id) - p_id: project id """ s_id = get_session_id(self.sockets, u_id) if s_id is not None: join_room(str(p_id), sid=s_id, namespace='/')
def join_collaborator_to_operation(self, u_id, op_id): """ json has: - u_id: user id(collaborator's id) - op_id: operation id """ s_id = get_session_id(self.sockets, u_id) if s_id is not None: join_room(str(op_id), sid=s_id)
def test_get_session_id(self): sockets = [{"u_id": 5, "s_id": 100}] assert get_session_id(sockets, 5) == 100
def test_get_session_id(self): with self.app.app_context(): s_id = get_session_id(self.sockets, self.user.id) assert s_id == self.test_sid
def remove_collaborator_from_room(self, u_id, p_id): s_id = get_session_id(self.sockets, u_id) if s_id is not None: leave_room(str(p_id), sid=s_id, namespace='/')
def remove_collaborator_from_operation(self, u_id, op_id): s_id = get_session_id(self.sockets, u_id) if s_id is not None: leave_room(str(op_id), sid=s_id)