def test_function_scan_bbu_not_available():
    testtxt = ("Exit Code: 0x10")
    assert_equals(scan_bbu(testtxt), {
        "bbu_nav": True,
        "bbu_charging": False,
        "bbu_ncharging": False
    })
def test_function_scan_bbu_fully_charged():
    testtxt = ("BBU status for Adapter: 0\n\n"
               " BatteryType: BBU\n"
               "Voltage: 3909 mV\n"
               "Current: 0 mA\n"
               "Temperature: 42 C\n\n"
               "BBU Firmware Status:\n\n"
               "  Charging Status              : None\n"
               "  Voltage                                 : OK\n"
               "  Temperature                             : OK\n"
               "  Learn Cycle Requested                   : No\n"
               "  Learn Cycle Active                      : No\n"
               "  Learn Cycle Status                      : OK\n"
               "  Learn Cycle Timeout                     : No\n"
               "  I2c Errors Detected                     : No\n"
               "  Battery Pack Missing                    : No\n"
               "  Battery Replacement required            : No\n"
               "  Remaining Capacity Low                  : No\n"
               "  Periodic Learn Required                 : No\n"
               "  Transparent Learn                       : No\n"
               "  No space to cache offload               : No\n"
               "  Pack is about to fail & should be replaced : No\n"
               "  Cache Offload premium feature required  : No\n"
               "  Module microcode update required        : No\n\n"
               "Battery state: \n\n"
               "GasGuageStatus:\n"
               "  Fully Discharged        : No\n"
               "  Fully Charged           : Yes\n"
               "  Discharging             : No\n"
               "  Initialized             : No\n"
               "  Remaining Time Alarm    : Yes\n"
               "  Remaining Capacity Alarm: No\n"
               "  Discharge Terminated    : No\n"
               "  Over Temperature        : No\n"
               "  Charging Terminated     : No\n"
               "  Over Charged            : No\n\n"
               "Relative State of Charge: 92 %\n"
               "Charger Status: Complete\n"
               "Remaining Capacity: 540 mAh\n"
               "Full Charge Capacity: 593 mAh\n"
               "isSOHGood: Yes\n\n"
               "Exit Code: 0x00")
    assert_equals(scan_bbu(testtxt), {
        "bbu_nav": False,
        "bbu_charging": False,
        "bbu_ncharging": False
    })
def test_function_scan_bbu_fully_charged():
    testtxt = ("BBU status for Adapter: 0\n\n"
               " BatteryType: BBU\n"
               "Voltage: 3909 mV\n"
               "Current: 0 mA\n"
               "Temperature: 42 C\n\n"
               "BBU Firmware Status:\n\n"
               "  Charging Status              : None\n"
               "  Voltage                                 : OK\n"
               "  Temperature                             : OK\n"
               "  Learn Cycle Requested                   : No\n"
               "  Learn Cycle Active                      : No\n"
               "  Learn Cycle Status                      : OK\n"
               "  Learn Cycle Timeout                     : No\n"
               "  I2c Errors Detected                     : No\n"
               "  Battery Pack Missing                    : No\n"
               "  Battery Replacement required            : No\n"
               "  Remaining Capacity Low                  : No\n"
               "  Periodic Learn Required                 : No\n"
               "  Transparent Learn                       : No\n"
               "  No space to cache offload               : No\n"
               "  Pack is about to fail & should be replaced : No\n"
               "  Cache Offload premium feature required  : No\n"
               "  Module microcode update required        : No\n\n"
               "Battery state: \n\n"
               "GasGuageStatus:\n"
               "  Fully Discharged        : No\n"
               "  Fully Charged           : Yes\n"
               "  Discharging             : No\n"
               "  Initialized             : No\n"
               "  Remaining Time Alarm    : Yes\n"
               "  Remaining Capacity Alarm: No\n"
               "  Discharge Terminated    : No\n"
               "  Over Temperature        : No\n"
               "  Charging Terminated     : No\n"
               "  Over Charged            : No\n\n"
               "Relative State of Charge: 92 %\n"
               "Charger Status: Complete\n"
               "Remaining Capacity: 540 mAh\n"
               "Full Charge Capacity: 593 mAh\n"
               "isSOHGood: Yes\n\n"
               "Exit Code: 0x00")
    assert_equals(scan_bbu(testtxt), {"bbu_nav": False,
                                      "bbu_charging": False,
                                      "bbu_ncharging": False})
def test_function_scan_bbu_not_available():
    testtxt = ("Exit Code: 0x10")
    assert_equals(scan_bbu(testtxt), {"bbu_nav": True,
                                      "bbu_charging": False,
                                      "bbu_ncharging": False})