Skip to content

Commit

Permalink
Merge branch 'feat/visualize-concurrent-users' of https://github.com/…
Browse files Browse the repository at this point in the history
…workaryangupta/MSS into feat/visualize-concurrent-users
  • Loading branch information
workaryangupta committed Jul 31, 2024
2 parents fedab62 + c496da2 commit ac82ded
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 4 additions & 4 deletions mslib/mscolab/sockets_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def handle_operation_selected(self, json_config):
token = json_config['token']
op_id = json_config['op_id']
user = User.verify_auth_token(token)
if not user:
if user is None:
return

# Remove the active user_id from any other operations first
Expand All @@ -85,7 +85,7 @@ def update_operation_list(self, json_config):
"""
token = json_config["token"]
user = User.verify_auth_token(token)
if not user:
if user is None:
return
socketio.emit('operation-list-update')

Expand All @@ -97,7 +97,7 @@ def join_creator_to_operation(self, json_config):
"""
token = json_config['token']
user = User.verify_auth_token(token)
if not user:
if user is None:
return
op_id = json_config['op_id']
join_room(str(op_id))
Expand Down Expand Up @@ -125,7 +125,7 @@ def handle_start_event(self, json_config):
# authenticate socket
token = json_config['token']
user = User.verify_auth_token(token)
if not user:
if user is None:
return

# fetch operations
Expand Down
6 changes: 5 additions & 1 deletion tests/_test_mscolab/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from mslib.mscolab.seed import add_user, get_user
from mslib.mscolab.utils import (get_recent_op_id, get_session_id,
get_message_dict, create_files,
os_fs_create_dir)
os_fs_create_dir, get_user_id)


class Test_Utils:
Expand Down Expand Up @@ -63,6 +63,10 @@ def test_get_session_id(self):
sockets = [{"u_id": 5, "s_id": 100}]
assert get_session_id(sockets, 5) == 100

def test_get_user_id(self):
sockets = [{"u_id": 9, "s_id": 101}]
assert get_user_id(sockets, 101) == 9

def test_get_message_dict(self):
message = Message(0, 0, "Moin")
message.user = User(*self.userdata)
Expand Down

0 comments on commit ac82ded

Please sign in to comment.