mirror of
https://github.com/token2/snapd.git
synced 2026-03-13 11:15:47 -07:00
* tests: add missing details to tests part 1 Add details to tests. This is part of the documentation plan. * fix error checking tests format
33 lines
1.1 KiB
YAML
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" ]
|