File: test_exceptions.py

package info (click to toggle)
python-aioice 0.10.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 424 kB
  • sloc: python: 3,832; makefile: 20; sh: 1
file content (18 lines) | stat: -rw-r--r-- 608 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import unittest

from aioice import stun


class ExceptionTest(unittest.TestCase):
    def test_transaction_failed(self) -> None:
        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) -> None:
        exc = stun.TransactionTimeout()
        self.assertEqual(str(exc), "STUN transaction timed out")