示例#1
0
 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='/')
示例#2
0
 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)
示例#3
0
 def test_get_session_id(self):
     sockets = [{"u_id": 5, "s_id": 100}]
     assert get_session_id(sockets, 5) == 100
示例#4
0
 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
示例#5
0
 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='/')
示例#6
0
 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)