def setUp(self): server = MockSocketIOServer() self.environ = {} socket = MockSocket(server, {}) socket.error = MagicMock() self.environ['socketio'] = socket self.ns = DeviceDataNamespace(self.environ, '/device')
def setUp(self): server = MockSocketIOServer() self.environ = {} socket = MockSocket(server, {}) socket.error = MagicMock() self.environ['socketio'] = socket self.ns = DeviceDataNamespace( self.environ, '/device' )
class DeviceNamespaceTest(TestCase): def setUp(self): server = MockSocketIOServer() self.environ = {} socket = MockSocket(server, {}) socket.error = MagicMock() self.environ['socketio'] = socket self.ns = DeviceDataNamespace(self.environ, '/device') def test_unauthenticated_event(self): pkt = { 'type': 'event', 'name': 'startmonitoringdevice', 'endpoint': '/device', 'args': ['test_device'] } self.ns.process_packet(pkt) assert self.environ['socketio'].error.called
class DeviceNamespaceTest(TestCase): def setUp(self): server = MockSocketIOServer() self.environ = {} socket = MockSocket(server, {}) socket.error = MagicMock() self.environ['socketio'] = socket self.ns = DeviceDataNamespace( self.environ, '/device' ) def test_unauthenticated_event(self): pkt = {'type': 'event', 'name': 'startmonitoringdevice', 'endpoint': '/device', 'args': ['test_device']} self.ns.process_packet(pkt) assert self.environ['socketio'].error.called