Esempio n. 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='/')
Esempio n. 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)
Esempio n. 3
0
 def test_get_session_id(self):
     sockets = [{"u_id": 5, "s_id": 100}]
     assert get_session_id(sockets, 5) == 100
Esempio n. 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
Esempio n. 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='/')
Esempio n. 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)