Esempio n. 1
0
    def test_send_connection_error(self):
        gatherer = RTCIceGatherer()
        transport = RTCIceTransport(gatherer)
        self.assertEqual(transport.state, "new")

        # fake connection
        gatherer._connection.connect = noop
        run(
            transport.start(
                RTCIceParameters(usernameFragment="foo", password="******")))
        self.assertEqual(transport.state, "completed")

        with self.assertRaises(ConnectionError):
            run(transport._send(b"foo"))
        self.assertEqual(transport.state, "failed")
    def test_send_connection_error(self):
        gatherer = RTCIceGatherer()
        transport = RTCIceTransport(gatherer)
        self.assertEqual(transport.state, 'new')

        # fake connection
        gatherer._connection.connect = noop
        run(
            transport.start(
                RTCIceParameters(usernameFragment='foo', password='******')))
        self.assertEqual(transport.state, 'completed')

        with self.assertRaises(ConnectionError):
            run(transport._send(b'foo'))
        self.assertEqual(transport.state, 'failed')