mirror of
https://github.com/clearlinux/swupd-client.git
synced 2026-09-06 21:51:32 +00:00
Enabling the --json-output flag as a global option
The --json-output flag can be enabled for every swupd command. This commit converts it to be a global flag, and enables it in every swupd command. Closes #869 Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit is contained in:
committed by
Otavio Pontes
parent
08765f32c4
commit
069af9decf
+36
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
# Author: Castulo Martinez
|
||||
# Email: castulo.martinez@intel.com
|
||||
|
||||
load "../testlib"
|
||||
|
||||
test_setup() {
|
||||
|
||||
create_test_environment "$TEST_NAME"
|
||||
create_bundle -L -n test-bundle -f /file_1 "$TEST_NAME"
|
||||
|
||||
}
|
||||
|
||||
@test "REM020: Removing a bundle using machine readable output" {
|
||||
|
||||
# the --json-output flag can be used so all the output of the bundle-remove
|
||||
# command is created as a JSON stream that can be read and parsed by other
|
||||
# applications interested into knowing real time status of the command
|
||||
|
||||
run sudo sh -c "$SWUPD bundle-remove --json-output $SWUPD_OPTS test-bundle"
|
||||
|
||||
assert_status_is 0
|
||||
expected_output=$(cat <<-EOM
|
||||
[
|
||||
{ "type" : "start", "section" : "bundle-remove" },
|
||||
{ "type" : "info", "msg" : "Deleting bundle files... " },
|
||||
{ "type" : "info", "msg" : "Total deleted files: 2 " },
|
||||
{ "type" : "info", "msg" : "Successfully removed 1 bundle " },
|
||||
{ "type" : "end", "section" : "bundle-remove", "status" : 0 }
|
||||
]
|
||||
EOM
|
||||
)
|
||||
assert_is_output "$expected_output"
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user