test_errors.py 515 B

1234567891011
  1. from openleadr import errors, enums
  2. def test_protocol_errors():
  3. for error in dir(errors):
  4. if isinstance(getattr(errors, error), type):
  5. err = getattr(errors, error)()
  6. if isinstance(err, errors.ProtocolError) and not type(err) == errors.ProtocolError:
  7. err_description = err.response_description
  8. err_code = err.response_code
  9. err_enum = err_description.replace(" ", "_")
  10. assert enums.STATUS_CODES[err_enum] == err_code