summaryrefslogtreecommitdiff
path: root/tests/test-config.sh
diff options
context:
space:
mode:
authorSinny Kumari <sinny@redhat.com>2018-08-17 21:25:56 +0530
committerAtomic Bot <atomic-devel@projectatomic.io>2018-08-20 14:31:15 +0000
commitdde3f1c0fb4d33c50968159a5843821c976f0c49 (patch)
tree8c23bb79cffdf4d92baaef91342c523c4526f967 /tests/test-config.sh
parente7305bbc8a262d595c7d1c507be7fba0e5a88d06 (diff)
downloadostree-dde3f1c0fb4d33c50968159a5843821c976f0c49.tar.gz
src/ostree: Add --group option to ostree config
Fetching value from a repo config using 'ostree config get SECTIONNAME.KEYNAME' didn't work in some cases like when having dots in Group Name entry. As per Desktop entry file specification, Group Name may contain all ASCII characters except for [ and ] and control characters. Link - https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-1.1.html Having --group option will help user to clearly specify Group Name and get desired result. It also adds test for ostree config get|set and bash completion for --group option Fixes https://github.com/ostreedev/ostree/issues/1565 Closes: #1696 Approved by: cgwalters
Diffstat (limited to 'tests/test-config.sh')
-rwxr-xr-xtests/test-config.sh55
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/test-config.sh b/tests/test-config.sh
new file mode 100755
index 00000000..b1ea3e5e
--- /dev/null
+++ b/tests/test-config.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+#
+# Copyright (C) 2018 Sinny Kumari <skumari@redhat.com>
+#
+# SPDX-License-Identifier: LGPL-2.0+
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+set -euo pipefail
+
+. $(dirname $0)/libtest.sh
+
+echo '1..2'
+
+ostree_repo_init repo
+${CMD_PREFIX} ostree remote add --repo=repo --set=xa.title=Flathub --set=xa.title-is-set=true flathub https://dl.flathub.org/repo/
+${CMD_PREFIX} ostree remote add --repo=repo org.mozilla.FirefoxRepo http://example.com/ostree/repo/
+
+${CMD_PREFIX} ostree config --repo=repo get core.mode > list.txt
+${CMD_PREFIX} ostree config --repo=repo get --group=core repo_version >> list.txt
+${CMD_PREFIX} ostree config --repo=repo get --group='remote "flathub"' 'xa.title' >> list.txt
+${CMD_PREFIX} ostree config --repo=repo get --group='remote "flathub"' 'xa.title-is-set' >> list.txt
+${CMD_PREFIX} ostree config --repo=repo get --group='remote "org.mozilla.FirefoxRepo"' url >> list.txt
+${CMD_PREFIX} cat list.txt
+
+assert_file_has_content list.txt "bare"
+assert_file_has_content list.txt "1"
+assert_file_has_content list.txt "Flathub"
+assert_file_has_content list.txt "true"
+assert_file_has_content list.txt "http://example.com/ostree/repo/"
+echo "ok config get"
+
+${CMD_PREFIX} ostree config --repo=repo set core.mode bare-user-only
+${CMD_PREFIX} ostree config --repo=repo set --group='remote "flathub"' 'xa.title' 'Nightly Flathub'
+${CMD_PREFIX} ostree config --repo=repo set --group='remote "flathub"' 'xa.title-is-set' 'false'
+${CMD_PREFIX} ostree config --repo=repo set --group='remote "org.mozilla.FirefoxRepo"' url http://example.com/ostree/
+
+assert_file_has_content repo/config "bare-user-only"
+assert_file_has_content repo/config "Nightly Flathub"
+assert_file_has_content repo/config "false"
+assert_file_has_content repo/config "http://example.com/ostree/"
+echo "ok config set"