aboutsummaryrefslogblamecommitdiffstats
path: root/_pytest/test_processteamjoin.py
blob: 64e704a3bfa6094c520bebad6662a0721544c749 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
                                                       
 


           
                                                                



                                     










                                                                                
                           



                                                  
 
                                               
from __future__ import print_function, unicode_literals

import glob
import json

def test_process_team_join(mock_websocket, realish_eventrouter):

    eventrouter = realish_eventrouter

    t = eventrouter.teams.keys()[0]

    #delete charles so we can add him
    del eventrouter.teams[t].users['U4096CBHC']

    assert len(eventrouter.teams[t].users) == 3

    socket = mock_websocket
    eventrouter.teams[t].ws = socket

    datafiles = glob.glob("_pytest/data/websocket/1485975606.59-team_join.json")

    for fname in datafiles:
        data = json.loads(open(fname, 'r').read())
        socket.add(data)
        eventrouter.receive_ws_callback(t)
        eventrouter.handle_next()

    assert len(eventrouter.teams[t].users) == 4