File size: 592 Bytes
15b8951
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import unittest

from aioice import stun


class ExceptionTest(unittest.TestCase):
    def test_transaction_failed(self):
        response = stun.Message(
            message_method=stun.Method.BINDING, message_class=stun.Class.RESPONSE
        )
        response.attributes["ERROR-CODE"] = (487, "Role Conflict")

        exc = stun.TransactionFailed(response)
        self.assertEqual(str(exc), "STUN transaction failed (487 - Role Conflict)")

    def test_transaction_timeout(self):
        exc = stun.TransactionTimeout()
        self.assertEqual(str(exc), "STUN transaction timed out")