Beispiel #1
0
    def test_custom_klass(self):
        class WS(WebSocketClient):
            data = []

            def received_message(self, m):
                super(WS, self).received_message(m)
                self.data.append(m)

        ws = create_ws('ws://example.com', None, None, klass=WS)
        self.assertTrue(isinstance(ws, WS))
Beispiel #2
0
 def create_ws(self, url, callback=None, protocols=None, extensions=None,
               klass=None):
     from loads.websockets import create_ws
     ws = create_ws(url, self._test_result,
                    callback=callback,
                    protocols=protocols,
                    extensions=extensions,
                    klass=klass,
                    test_case=self)
     self._ws.append(ws)
     return ws
Beispiel #3
0
 def create_ws(self, url, callback=None, protocols=None, extensions=None,
               klass=None):
     from loads.websockets import create_ws
     ws = create_ws(url, self._test_result,
                    callback=callback,
                    protocols=protocols,
                    extensions=extensions,
                    klass=klass,
                    test_case=self)
     self._ws.append(ws)
     return ws
Beispiel #4
0
    def test_custom_klass(self):

        class WS(WebSocketClient):
            data = []

            def received_message(self, m):
                super(WS, self).received_message(m)
                self.data.append(m)

        ws = create_ws('ws://example.com', None, None, klass=WS)
        self.assertTrue(isinstance(ws, WS))
Beispiel #5
0
 def create_ws(self, url, callback, protocols=None, extensions=None):
     from loads.websockets import create_ws
     return create_ws(url, callback, self._test_result, protocols,
                      extensions)