Пример #1
0
 async def test_connect_fail_keyerror(self):
     connector = ConnectorWebexTeams({}, opsdroid=OpsDroid())
     connector.clean_up_webhooks = amock.CoroutineMock()
     connector.subscribe_to_rooms = amock.CoroutineMock()
     connector.set_own_id = amock.CoroutineMock()
     await connector.connect()
     self.assertLogs("_LOGGER", "error")
Пример #2
0
    async def test_connect(self):
        connector = ConnectorWebexTeams({"access-token": "abc123"},
                                        opsdroid=OpsDroid())

        opsdroid = amock.CoroutineMock()
        opsdroid.eventloop = self.loop
        connector.clean_up_webhooks = amock.CoroutineMock()
        connector.subscribe_to_rooms = amock.CoroutineMock()
        connector.set_own_id = amock.CoroutineMock()

        with amock.patch("websockets.connect", new=amock.CoroutineMock()):
            await connector.connect()

        self.assertTrue(connector.clean_up_webhooks.called)
        self.assertTrue(connector.subscribe_to_rooms.called)
        self.assertTrue(connector.set_own_id.called)