def test_enum_type_to_string(self): """ Convert the enumeration member to string, and test is it returns the correct string. """ assert opendnp3.AuthErrorCodeToString( opendnp3.AuthErrorCode.AUTHORIZATION_FAILED ) == "AUTHORIZATION_FAILED" assert opendnp3.CertificateTypeToString( opendnp3.CertificateType.ID_CERTIFICATE) == "ID_CERTIFICATE" assert opendnp3.ChallengeReasonToString( opendnp3.ChallengeReason.CRITICAL) == "CRITICAL" assert opendnp3.ChannelStateToString( opendnp3.ChannelState.CLOSED) == "CLOSED" assert opendnp3.CommandPointStateToString( opendnp3.CommandPointState.SELECT_SUCCESS) == "SELECT_SUCCESS" assert opendnp3.CommandStatusToString( opendnp3.CommandStatus.DOWNSTREAM_FAIL) == "DOWNSTREAM_FAIL" assert opendnp3.ControlCodeToString( opendnp3.ControlCode.LATCH_ON) == "LATCH_ON" assert opendnp3.DoubleBitToString( opendnp3.DoubleBit.INTERMEDIATE) == "INTERMEDIATE" assert opendnp3.FlagsTypeToString( opendnp3.FlagsType.DoubleBinaryInput) == "DoubleBinaryInput" assert opendnp3.FlowControlToString( opendnp3.FlowControl.Hardware) == "Hardware" assert opendnp3.FunctionCodeToString( opendnp3.FunctionCode.GET_FILE_INFO) == "GET_FILE_INFO" assert opendnp3.GroupVariationToString( opendnp3.GroupVariation.Group1Var0 ) == "Binary Input - Any Variation" assert opendnp3.HMACTypeToString( opendnp3.HMACType.NO_MAC_VALUE) == "NO_MAC_VALUE" assert opendnp3.IntervalUnitsToString( opendnp3.IntervalUnits.Months9) == "Months9" assert opendnp3.KeyChangeMethodToString( opendnp3.KeyChangeMethod.AES_128_SHA1_HMAC) == "AES_128_SHA1_HMAC" assert opendnp3.KeyStatusToString( opendnp3.KeyStatus.COMM_FAIL) == "COMM_FAIL" assert opendnp3.KeyWrapAlgorithmToString( opendnp3.KeyWrapAlgorithm.AES_128) == "AES_128" assert opendnp3.LinkFunctionToString( opendnp3.LinkFunction.PRI_CONFIRMED_USER_DATA ) == "PRI_CONFIRMED_USER_DATA" assert opendnp3.MasterTaskTypeToString( opendnp3.MasterTaskType.CLEAR_RESTART) == "CLEAR_RESTART" assert opendnp3.ParityToString(opendnp3.Parity.Odd) == "Odd" assert opendnp3.QualifierCodeToString( opendnp3.QualifierCode.UINT8_START_STOP) == "8-bit start stop" assert opendnp3.StopBitsToString( opendnp3.StopBits.OnePointFive) == "OnePointFive" assert opendnp3.TaskCompletionToString( opendnp3.TaskCompletion.FAILURE_BAD_RESPONSE ) == "FAILURE_BAD_RESPONSE" assert opendnp3.UserOperationToString( opendnp3.UserOperation.OP_UNDEFINED) == "OP_UNDEFINED" assert opendnp3.UserRoleToString(opendnp3.UserRole.VIEWER) == "VIEWER"
def OnStateChange(self, state): _log.debug('In AppChannelListener.OnStateChange: state={}'.format( opendnp3.ChannelStateToString(state)))