File: task.yaml

package info (click to toggle)
snapd 2.72-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 80,412 kB
  • sloc: sh: 16,506; ansic: 16,211; python: 11,213; makefile: 1,919; exp: 190; awk: 58; xml: 22
file content (32 lines) | stat: -rw-r--r-- 1,129 bytes parent folder | download | duplicates (3)
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
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" ]