diff options
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/data/cmd-fake | 65 |
1 files changed, 43 insertions, 22 deletions
diff --git a/tests/data/cmd-fake b/tests/data/cmd-fake index e363651..7cde65e 100755 --- a/tests/data/cmd-fake +++ b/tests/data/cmd-fake @@ -7,12 +7,35 @@ command="$1" shift type="$1" -if [ "$1" != "keytab" ] ; then - echo "Unknown object type $1" >&2 +shift +if [ "$type" != "keytab" ] ; then + echo "Unknown object type $type" >&2 exit 1 fi -shift -if [ "$command" = "attr" ] ; then + +case "$command" in +getattr) + if [ -n "$3" ] ; then + echo "Too many arguments" >&2 + exit 1 + fi + if [ "$2" != sync ] ; then + echo "Unknown attribute $2" >&2 + exit 1 + fi + case "$1" in + service/fake-srvtab) + if [ -f sync-kaserver ] ; then + echo "kaserver" + fi + ;; + *) + echo "Looking at sync attribute of wrong keytab" >&2 + exit 1 + ;; + esac + ;; +setattr) if [ -n "$4" ] ; then echo "Too many arguments" >&2 exit 1 @@ -21,27 +44,13 @@ if [ "$command" = "attr" ] ; then echo "Unknown attribute $2" >&2 exit 1 fi -fi -if [ "$command" != "attr" ] && [ -n "$2" ] ; then - echo "Too many arguments" >&2 - exit 1 -fi - -case "$command" in -attr) case "$1" in service/fake-srvtab) - if [ -n "$3" ] ; then - if [ "$3" != "kaserver" ] ; then - echo "Invalid attribute value $3" >&2 - exit 1 - fi - touch sync-kaserver - else - if [ -f sync-kaserver ] ; then - echo "kaserver" - fi + if [ "$3" != "kaserver" ] ; then + echo "Invalid attribute value $3" >&2 + exit 1 fi + touch sync-kaserver ;; *) echo "Looking at sync attribute of wrong keytab" >&2 @@ -50,6 +59,10 @@ attr) esac ;; get) + if [ -n "$2" ] ; then + echo "Too many arguments" >&2 + exit 1 + fi case "$1" in service/fake-test) cat data/fake-data @@ -66,6 +79,10 @@ get) esac ;; show) + if [ -n "$2" ] ; then + echo "Too many arguments" >&2 + exit 1 + fi if [ "$1" = "service/fake-test" ] ; then echo "Some stuff about $1" exit 0 @@ -75,6 +92,10 @@ show) fi ;; expires) + if [ -n "$2" ] ; then + echo "Too many arguments" >&2 + exit 1 + fi echo "Expiration date of $1" exit 0 ;; |