# Path: pyipmi/msgs/message.py
# class BaseField(object):
# class ByteArray(BaseField):
# class VariableByteArray(ByteArray):
# class UnsignedInt(BaseField):
# class String(BaseField):
# class CompletionCode(UnsignedInt):
# class UnsignedIntMask(UnsignedInt):
# class Timestamp(UnsignedInt):
# class Conditional(object):
# class Optional(object):
# class RemainingBytes(BaseField):
# class Bitfield(BaseField):
#     class Bit(object):
#     class ReservedBit(Bit):
#     class BitWrapper(object):
# class GroupExtensionIdentifier(UnsignedInt):
# class Message(object):
#     def __init__(self, name, length, default=None):
#     def decode(self, obj, data):
#     def encode(self, obj, data):
#     def create(self):
#     def __init__(self, name, length, default=None):
#     def _length(self, obj):
#     def encode(self, obj, data):
#     def decode(self, obj, data):
#     def create(self):
#     def __init__(self, name, length_func):
#     def _length(self, obj):
#     def create(self):
#     def encode(self, obj, data):
#     def decode(self, obj, data):
#     def create(self):
#     def encode(self, obj, data):
#     def decode(self, obj, data):
#     def create(self):
#     def __init__(self, name='completion_code'):
#     def decode(self, obj, data):
#     def __init__(self, name, length, mask, default=None):
#     def __init__(self, name):
#     def __init__(self, cond_fn, field):
#     def __getattr__(self, name):
#     def encode(self, obj, data):
#     def decode(self, obj, data):
#     def create(self):
#     def __init__(self, field):
#     def __getattr__(self, name):
#     def decode(self, obj, data):
#     def encode(self, obj, data):
#     def create(self):
#     def __init__(self, name):
#     def encode(self, obj, data):
#     def decode(self, obj, data):
#     def create(self):
#         def __init__(self, name, width=1, default=None):
#         def __init__(self, width, default=0):
#         def __init__(self, bits, length):
#         def __str__(self):
#         def __int__(self):
#         def _get_value(self):
#         def _set_value(self, value):
#     def __init__(self, name, length, *bits):
#     def _precalc_offsets(self):
#     def encode(self, obj, data):
#     def decode(self, obj, data):
#     def create(self):
#     def __init__(self, name='picmg_identifier', value=None):
#     def __init__(self, *args, **kwargs):
#     def _set_field(self, name, value):
#     def __str__(self):
#     def _create_fields(self):
#     def _pack(self):
#     def _encode(self):
#     def _decode(self, data):
#     def _is_request(self):
#     def _is_response(self):
#     RESERVED_FIELD_NAMES = ['cmdid', 'netfn', 'lun', 'group_extension']


from nose.tools import eq_
from pyipmi.msgs import encode_message, decode_message
import pyipmi.msgs.chassis
    eq_(m.completion_code, 0x00)
    eq_(m.current_power_state.power_on, 0)
    eq_(m.current_power_state.power_overload, 1)
    eq_(m.current_power_state.interlock, 0)
    eq_(m.current_power_state.power_fault, 1)
    eq_(m.current_power_state.power_control_fault, 0)
    eq_(m.current_power_state.power_restore_policy, 3)

    eq_(m.last_power_event.ac_failed, 0)
    eq_(m.last_power_event.power_overload, 1)
    eq_(m.last_power_event.power_interlock, 0)
    eq_(m.last_power_event.power_fault, 1)
    eq_(m.last_power_event.power_is_on_via_ipmi_command, 0)

    eq_(m.misc_chassis_state.chassis_intrusion_active, 0)
    eq_(m.misc_chassis_state.front_panel_lockout_active, 1)
    eq_(m.misc_chassis_state.drive_fault, 0)
    eq_(m.misc_chassis_state.cooling_fault_detected, 1)


def test_getchassisstatus_decode_valid_optional_byte_rsp():
    m = pyipmi.msgs.chassis.GetChassisStatusRsp()
    decode_message(m, b'\x00\x00\x00\00\xaa')
    eq_(m.completion_code, 0x00)
    eq_(m.front_panel_button_capabilities, 0xaa)


def test_chassiscontrol_encode_valid_req():
    m = pyipmi.msgs.chassis.ChassisControlReq()
    m.control.option = 1

# Path: pyipmi/msgs/message.py
# class BaseField(object):
# class ByteArray(BaseField):
# class VariableByteArray(ByteArray):
# class UnsignedInt(BaseField):
# class String(BaseField):
# class CompletionCode(UnsignedInt):
# class UnsignedIntMask(UnsignedInt):
# class Timestamp(UnsignedInt):
# class Conditional(object):
# class Optional(object):
# class RemainingBytes(BaseField):
# class Bitfield(BaseField):
#     class Bit(object):
#     class ReservedBit(Bit):
#     class BitWrapper(object):
# class GroupExtensionIdentifier(UnsignedInt):
# class Message(object):
#     def __init__(self, name, length, default=None):
#     def decode(self, obj, data):
#     def encode(self, obj, data):
#     def create(self):
#     def __init__(self, name, length, default=None):
#     def _length(self, obj):
#     def encode(self, obj, data):
#     def decode(self, obj, data):
#     def create(self):
#     def __init__(self, name, length_func):
#     def _length(self, obj):
#     def create(self):
#     def encode(self, obj, data):
#     def decode(self, obj, data):
#     def create(self):
#     def encode(self, obj, data):
#     def decode(self, obj, data):
#     def create(self):
#     def __init__(self, name='completion_code'):
#     def decode(self, obj, data):
#     def __init__(self, name, length, mask, default=None):
#     def __init__(self, name):
#     def __init__(self, cond_fn, field):
#     def __getattr__(self, name):
#     def encode(self, obj, data):
#     def decode(self, obj, data):
#     def create(self):
#     def __init__(self, field):
#     def __getattr__(self, name):
#     def decode(self, obj, data):
#     def encode(self, obj, data):
#     def create(self):
#     def __init__(self, name):
#     def encode(self, obj, data):
#     def decode(self, obj, data):
#     def create(self):
#         def __init__(self, name, width=1, default=None):
#         def __init__(self, width, default=0):
#         def __init__(self, bits, length):
#         def __str__(self):
#         def __int__(self):
#         def _get_value(self):
#         def _set_value(self, value):
#     def __init__(self, name, length, *bits):
#     def _precalc_offsets(self):
#     def encode(self, obj, data):
#     def decode(self, obj, data):
#     def create(self):
#     def __init__(self, name='picmg_identifier', value=None):
#     def __init__(self, *args, **kwargs):
#     def _set_field(self, name, value):
#     def __str__(self):
#     def _create_fields(self):
#     def _pack(self):
#     def _encode(self):
#     def _decode(self, data):
#     def _is_request(self):
#     def _is_response(self):
#     RESERVED_FIELD_NAMES = ['cmdid', 'netfn', 'lun', 'group_extension']


# Path: tests/msgs/test_chassis.py
from nose.tools import eq_
from pyipmi.msgs import encode_message, decode_message
import pyipmi.msgs.chassis

    eq_(m.completion_code, 0x00)
    eq_(m.current_power_state.power_on, 0)
    eq_(m.current_power_state.power_overload, 1)
    eq_(m.current_power_state.interlock, 0)
    eq_(m.current_power_state.power_fault, 1)
    eq_(m.current_power_state.power_control_fault, 0)
    eq_(m.current_power_state.power_restore_policy, 3)

    eq_(m.last_power_event.ac_failed, 0)
    eq_(m.last_power_event.power_overload, 1)
    eq_(m.last_power_event.power_interlock, 0)
    eq_(m.last_power_event.power_fault, 1)
    eq_(m.last_power_event.power_is_on_via_ipmi_command, 0)

    eq_(m.misc_chassis_state.chassis_intrusion_active, 0)
    eq_(m.misc_chassis_state.front_panel_lockout_active, 1)
    eq_(m.misc_chassis_state.drive_fault, 0)
    eq_(m.misc_chassis_state.cooling_fault_detected, 1)


def test_getchassisstatus_decode_valid_optional_byte_rsp():
    m = pyipmi.msgs.chassis.GetChassisStatusRsp()
    decode_message(m, b'\x00\x00\x00\00\xaa')
    eq_(m.completion_code, 0x00)
    eq_(m.front_panel_button_capabilities, 0xaa)


def test_chassiscontrol_encode_valid_req():
    m = pyipmi.msgs.chassis.ChassisControlReq()
    m.control.option = 1

    data = encode_message(m)