Updated acpi tests

Trying to cover the currently implemented tests, but I don't have a
system with acpi available for testing. Relying on assumptions so far.
pull/1080/head
Nils Winkler 2017-10-23 17:07:04 +02:00
parent 812f49e457
commit 3aed38c79f
1 changed files with 35 additions and 7 deletions

View File

@ -78,39 +78,67 @@ function setup_pmset {
function setup_acpi {
percent="$1"
status="$2"
function acpi {
printf "Battery 0: Charging, %s, 01:02:48 until charged" "${percent}"
printf "Battery 0: %s, %s, 01:02:48 until charged" "${status}" "${percent}"
}
}
@test 'plugins battery: battery-percentage with acpi, 100%' {
@test 'plugins battery: battery-percentage with acpi, 100% Full' {
setup_command_exists "acpi"
setup_acpi "100%"
setup_acpi "100%" "Full"
run battery_percentage
assert_output "100"
}
@test 'plugins battery: battery-percentage with acpi, 98%' {
@test 'plugins battery: battery-percentage with acpi, 98% Charging' {
setup_command_exists "acpi"
setup_acpi "98%"
setup_acpi "98%" "Charging"
run battery_percentage
assert_output "98"
}
@test 'plugins battery: battery-percentage with acpi, 4%' {
@test 'plugins battery: battery-percentage with acpi, 98% Discharging' {
setup_command_exists "acpi"
setup_acpi "4%"
setup_acpi "98%" "Discharging"
run battery_percentage
assert_output "98"
}
@test 'plugins battery: battery-percentage with acpi, 98% Unknown' {
setup_command_exists "acpi"
setup_acpi "98%" "Unknown"
run battery_percentage
assert_output "98"
}
@test 'plugins battery: battery-percentage with acpi, 4% Charging' {
setup_command_exists "acpi"
setup_acpi "4%" "Charging"
run battery_percentage
assert_output "4"
}
@test 'plugins battery: battery-percentage with acpi, 4% no status' {
setup_command_exists "acpi"
setup_acpi "4%" ""
run battery_percentage
assert_output "-1"
}
#######################
#
# upower