From 8601690c917f7d35245da160de46d8c2558ff92f Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Fri, 17 Nov 2023 08:54:04 +0100 Subject: [PATCH] Test: added write tests for nacm mount --- test/test_nacm_mount.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/test_nacm_mount.sh b/test/test_nacm_mount.sh index b91fbf84..48588bad 100755 --- a/test/test_nacm_mount.sh +++ b/test/test_nacm_mount.sh @@ -259,6 +259,25 @@ expectpart "$(curl -u wilma:bar $CURLOPTS -X GET -H "Accept: application/yang-da new "restconf guest read mnt mylist0 expect access denied" expectpart "$(curl -u guest:bar $CURLOPTS -X GET -H "Accept: application/yang-data+xml" $RCPROTO://localhost/restconf/data/clixon-example:top/mylist=x/mnt/clixon-mount0:mymount0/mylist1=x1)" 0 "HTTP/$HVER 403" 'applicationaccess-deniederrordefault deny' +# write +new "restconf admin write mnt mylist0 expect ok" +expectpart "$(curl -u andy:bar $CURLOPTS -X POST -H "Content-Type: application/yang-data+xml" $RCPROTO://localhost/restconf/data/clixon-example:top/mylist=x/mnt/clixon-mount0:mymount0 -d 'andy')" 0 "HTTP/$HVER 201" + +new "restconf admin write mnt mylist1 expect ok" +expectpart "$(curl -u andy:bar $CURLOPTS -X POST -H "Content-Type: application/yang-data+xml" $RCPROTO://localhost/restconf/data/clixon-example:top/mylist=x/mnt/clixon-mount0:mymount0 -d 'andy')" 0 "HTTP/$HVER 201" + +new "restconf limited write mnt mylist0 expect ok" +expectpart "$(curl -u wilma:bar $CURLOPTS -X POST -H "Content-Type: application/yang-data+xml" $RCPROTO://localhost/restconf/data/clixon-example:top/mylist=x/mnt/clixon-mount0:mymount0 -d 'wilma')" 0 "HTTP/$HVER 201" + +new "restconf limited write mnt mylist1 expect fail" +expectpart "$(curl -u wilma:bar $CURLOPTS -X POST -H "Content-Type: application/yang-data+xml" $RCPROTO://localhost/restconf/data/clixon-example:top/mylist=x/mnt/clixon-mount0:mymount0 -d 'wilma')" 0 "HTTP/$HVER 403" "access-denied" + +new "restconf guest write mnt mylist0 expect fail" +expectpart "$(curl -u guest:bar $CURLOPTS -X POST -H "Content-Type: application/yang-data+xml" $RCPROTO://localhost/restconf/data/clixon-example:top/mylist=x/mnt/clixon-mount0:mymount0 -d 'guest')" 0 "HTTP/$HVER 403" "access-denied" + +new "restconf admin get check" +expectpart "$(curl -u andy:bar $CURLOPTS -X GET -H "Accept: application/yang-data+xml" $RCPROTO://localhost/restconf/data/clixon-example:top/mylist=x/mnt/clixon-mount0:mymount0)" 0 "HTTP/$HVER 200" 'andy' 'wilma' 'andy' --not-- 'wilma' 'guest' + if [ $RC -ne 0 ]; then new "Kill restconf daemon" stop_restconf