Files
snapd/tests/main/auth-errors/task.yaml
Sergio Cazzolato c1f90928fe tests: fix tests checks and add missing details in spread tests - part 1 (#13384)
* tests: add missing details to tests part 1

Add details to tests. This is part of the documentation plan.

* fix error checking tests format
2023-11-24 20:50:23 +02:00

33 lines
1.1 KiB
YAML

summary: Check that the authentication errors are properly reported.
details: |
Verify that in ubuntu core just authenticated users are allowed to
install snaps ans to connect interfaces. Also validate the error
messages are the expected.
systems: [-ubuntu-core-*]
prepare: |
mkdir -p /home/test/.snap
echo -n "{\"macaroon\":\"yummy\",\"discharges\":[ \"some \"]}" > /home/test/.snap/auth.json
chown -R test:test /home/test/.snap
restore: |
rm -rf /home/test/.snap
execute: |
echo "An unauthenticated user cannot install snaps"
if su - -c "snap install test-snapd-sh" test 2> install.output; then
echo "Expected error installing snap from unauthenticated account"
exit 1
fi
expected="error: access denied (try with sudo)"
[ "$(cat install.output)" = "$expected" ]
echo "An unauthenticated user cannot connect plugs to slots"
if su - -c "snap connect foo:bar baz:fromp" test 2> connect.output; then
echo "Expected error connecting plugs to slots from unauthenticated account"
exit 1
fi
[ "$(cat connect.output)" = "$expected" ]