Exemplo n.º 1
0
    def test_socket_connect(self):
        """
        Test that there is a FlaskSocketIO emit signal when the user connects
        to the Websocket. The user should receive all the deployments.
        """
        tmp_io_client = socketio.test_client(self.app, namespace='/status')
        emitted = tmp_io_client.get_received('/status')[0]

        self.assertEqual(emitted['namespace'], '/status')
        self.assertEqual(emitted['name'], 'connect')
        self.assertEqual(emitted['args'][0], 'connected')

        tmp_io_client.disconnect()
        emitted = tmp_io_client.get_received('/status')[0]
        self.assertEqual(emitted['args'][0], 'disconnected')
    def test_socket_connect(self):
        """
        Test that there is a FlaskSocketIO emit signal when the user connects
        to the Websocket. The user should receive all the deployments.
        """
        tmp_io_client = socketio.test_client(self.app, namespace="/status")
        emitted = tmp_io_client.get_received("/status")[0]

        self.assertEqual(emitted["namespace"], "/status")
        self.assertEqual(emitted["name"], "connect")
        self.assertEqual(emitted["args"][0], "connected")

        tmp_io_client.disconnect()
        emitted = tmp_io_client.get_received("/status")[0]
        self.assertEqual(emitted["args"][0], "disconnected")
Exemplo n.º 3
0
    def setUp(self):
        db.create_all()
        self.io_client = socketio.test_client(self.app, namespace='/status')
        self.connected = self.io_client.get_received('/status')[0]['name']

        assert self.connected == 'connect'
    def setUp(self):
        db.create_all()
        self.io_client = socketio.test_client(self.app, namespace="/status")
        self.connected = self.io_client.get_received("/status")[0]["name"]

        assert self.connected == "connect"