mirror of
https://github.com/clearlinux/swupd-client.git
synced 2026-09-03 12:11:28 +00:00
Instead of relying on a custom global_setup and global_teardown functions, migrate to the use of bats' setup_file and teardown_file functions. Signed-off-by: William Douglas <william.douglas@intel.com>
67 lines
1.3 KiB
Bash
Executable File
67 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bats
|
|
|
|
load "../testlib"
|
|
|
|
setup_file() {
|
|
|
|
create_test_environment -e "$TEST_NAME"
|
|
create_version "$TEST_NAME" 100
|
|
|
|
}
|
|
|
|
teardown_file() {
|
|
|
|
destroy_test_environment --force "$TEST_NAME"
|
|
|
|
}
|
|
|
|
@test "UPD034: Show current OS version and latest version available on server" {
|
|
|
|
run sudo sh -c "$SWUPD update $SWUPD_OPTS --status"
|
|
|
|
assert_status_is 0
|
|
expected_output=$(cat <<-EOM
|
|
Current OS version: 10
|
|
Latest server version: 100
|
|
There is a new OS version available: 100
|
|
EOM
|
|
)
|
|
assert_is_output "$expected_output"
|
|
|
|
}
|
|
|
|
@test "UPD035: Show current OS version when os-release has double quote on version" {
|
|
|
|
set_current_version "$TEST_NAME" "\\'10\\'"
|
|
|
|
run sudo sh -c "$SWUPD update $SWUPD_OPTS --status"
|
|
|
|
assert_status_is 0
|
|
expected_output=$(cat <<-EOM
|
|
Current OS version: 10
|
|
Latest server version: 100
|
|
There is a new OS version available: 100
|
|
EOM
|
|
)
|
|
assert_is_output "$expected_output"
|
|
|
|
}
|
|
|
|
@test "UPD036: Show current OS version when os-release has single quote on version" {
|
|
|
|
set_current_version "$TEST_NAME" "\\'10\\'"
|
|
|
|
run sudo sh -c "$SWUPD update $SWUPD_OPTS --status"
|
|
|
|
assert_status_is 0
|
|
expected_output=$(cat <<-EOM
|
|
Current OS version: 10
|
|
Latest server version: 100
|
|
There is a new OS version available: 100
|
|
EOM
|
|
)
|
|
assert_is_output "$expected_output"
|
|
|
|
}
|
|
#WEIGHT=1
|