mirror of
https://github.com/token2/snapd.git
synced 2026-03-13 11:15:47 -07:00
28 lines
946 B
YAML
28 lines
946 B
YAML
summary: Check that the authentication errors are properly reported.
|
|
|
|
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" ]
|