summaryrefslogtreecommitdiff
path: root/itests/test_reconnect.py
blob: 8318af64d8a7178404f24b504986051e1585f15a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import unittest
from slixmpp.test.integration import SlixIntegration


class TestReconnect(SlixIntegration):
    async def asyncSetUp(self):
        await super().asyncSetUp()
        self.add_client(
            self.envjid('CI_ACCOUNT1'),
            self.envstr('CI_ACCOUNT1_PASSWORD'),
        )
        await self.connect_clients()

    async def test_disconnect_connect(self):
        """Check we can disconnect and connect again"""
        await self.clients[0].disconnect()
        self.clients[0].connect()
        await self.clients[0].wait_until('session_start')

    async def test_reconnect(self):
        """Check we can reconnect()"""
        self.clients[0].reconnect()
        await self.clients[0].wait_until("session_start")

suite = unittest.TestLoader().loadTestsFromTestCase(TestReconnect)