Exemple #1
0
    def test_simple_updates(self):
        num_updates = 0

        def hook(cob, t):
            nonlocal num_updates
            num_updates += 1

        updater = Updater('XBTZAR', 'key', 'secret', [hook])
        updater.url = 'ws://localhost:8765/simple_updates'

        with self.assertRaises(futures.TimeoutError):
            asyncio.run(asyncio.wait_for(updater.run(), 5))

        self.assertEqual(num_updates, 4)
Exemple #2
0
 def test_disconnecting_server(self):
     # no exceptions should be raised, the coroutine just finishes
     updater = Updater('XBTZAR', 'key', 'secret', [])
     updater.url = 'ws://localhost:8765/close_connection'
     asyncio.run(updater.run())