From b459586d96ec1f765d7aed86538b8d8576977f6c Mon Sep 17 00:00:00 2001 From: Trygve Aaberge Date: Tue, 2 Apr 2019 09:58:56 +0200 Subject: Cleanup tests and make them compatible with python 3 This mainly adds team, channel_general and user_alice as fixtures, so we can use those directly instead of picking arbitrary ones from the lists. It also adds assertions to some tests which where missing it. --- _pytest/test_processsubteamupdated.py | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) (limited to '_pytest/test_processsubteamupdated.py') diff --git a/_pytest/test_processsubteamupdated.py b/_pytest/test_processsubteamupdated.py index 5781240..0a98aaa 100644 --- a/_pytest/test_processsubteamupdated.py +++ b/_pytest/test_processsubteamupdated.py @@ -1,31 +1,18 @@ from __future__ import print_function, unicode_literals -import glob -from mock import patch, call -from wee_slack import SlackTeam, SlackSubteam import json -def test_process_subteam_self_updated(mock_websocket, realish_eventrouter): - eventrouter = realish_eventrouter +def test_process_subteam_self_updated(realish_eventrouter, team): + assert len(team.subteams) == 1 - t = eventrouter.teams.keys()[0] - - assert len(eventrouter.teams[t].subteams) == 1 - - socket = mock_websocket - eventrouter.teams[t].ws = socket - datafiles = glob.glob("_pytest/data/websocket/1483975206.59-subteam_updated.json") - - for fname in datafiles: - data = json.loads(open(fname, 'r').read()) - socket.add(data) - eventrouter.receive_ws_callback(t) - eventrouter.handle_next() - team = eventrouter.teams[t] - subteam = team.subteams.values()[0] + datafile = '_pytest/data/websocket/1483975206.59-subteam_updated.json' + data = json.loads(open(datafile, 'r').read()) + team.ws.add(data) + realish_eventrouter.receive_ws_callback(team.team_hash) + realish_eventrouter.handle_next() + subteam = team.subteams['TGX0ALBK3'] assert data['subteam']['handle'] == subteam.handle assert data['subteam']['description'] == subteam.description assert data['subteam']['name'] == subteam.name - -- cgit