Пример #1
0
 def setUp(self):
     server = MockSocketIOServer()
     self.environ = {}
     socket = MockSocket(server, {})
     socket.error = MagicMock()
     self.environ['socketio'] = socket
     self.ns = DeviceDataNamespace(self.environ, '/device')
Пример #2
0
 def setUp(self):
     server = MockSocketIOServer()
     self.environ = {}
     socket = MockSocket(server, {})
     socket.error = MagicMock()
     self.environ['socketio'] = socket
     self.ns = DeviceDataNamespace(
         self.environ,
         '/device'
     )
Пример #3
0
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
Пример #4
0
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