1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
summary: Ensure that the desktop interface works.
details: |
The desktop interface allows to access the different resources.
The test-snapd-desktop snap checks files and dirs are accessible through the
desktop interface.
systems:
- -amazon-linux-2-*
- -ubuntu-14.04-*
- -ubuntu-core-*
prepare: |
echo "Given the desktop snap is installed"
snap try "$TESTSLIB"/snaps/test-snapd-desktop
tests.session -u test prepare
restore: |
tests.session -u test restore
execute: |
dirs="/var/cache/fontconfig /usr/share/icons /usr/share/pixmaps"
files="/etc/xdg/user-dirs.conf /etc/xdg/user-dirs.defaults"
echo "The plug is connected by default"
snap interfaces -i desktop | MATCH ":desktop .*test-snapd-desktop"
echo "Then the snap is able to desktop files and directories"
# shellcheck disable=SC2086
tests.session -u test exec test-snapd-desktop.check-files $files
# shellcheck disable=SC2086
tests.session -u test exec test-snapd-desktop.check-dirs $dirs
if [ "$(snap debug confinement)" = partial ] ; then
exit 0
fi
echo "When the plug is disconnected"
snap disconnect test-snapd-desktop:desktop
echo "Then the snap is not able to access the desktop files"
for file in $files; do
if tests.session -u test exec test-snapd-desktop.check-files "$file" 2> call.error; then
echo "Expected permission error calling desktop with disconnected plug"
exit 1
fi
MATCH "Permission denied" < call.error
done
echo "Then the snap is not able to access the desktop dirs"
for dir in $dirs; do
if tests.session -u test exec test-snapd-desktop.check-dirs "$dir" 2> call.error; then
echo "Expected permission error calling desktop with disconnected plug"
exit 1
fi
MATCH "Permission denied" < call.error
done
|