File: test_errors.py

package info (click to toggle)
python-openleadr-python 0.5.34%2Bdfsg.1-2
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,496 kB
  • sloc: python: 6,942; xml: 663; makefile: 32; sh: 18
file content (11 lines) | stat: -rw-r--r-- 515 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
from openleadr import errors, enums

def test_protocol_errors():
    for error in dir(errors):
        if isinstance(getattr(errors, error), type):
            err = getattr(errors, error)()
            if isinstance(err, errors.ProtocolError) and not type(err) == errors.ProtocolError:
                err_description = err.response_description
                err_code = err.response_code
                err_enum = err_description.replace(" ", "_")
                assert enums.STATUS_CODES[err_enum] == err_code