From 0a76fb12d8572afa5683436d674abcdd83d96e82 Mon Sep 17 00:00:00 2001 From: null Date: Sat, 17 May 2025 17:08:20 +0000 Subject: [PATCH] test: update command validation test with new cases --- tests/test_validate_command_access.sh | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/tests/test_validate_command_access.sh b/tests/test_validate_command_access.sh index b5893f8..00371b9 100755 --- a/tests/test_validate_command_access.sh +++ b/tests/test_validate_command_access.sh @@ -8,13 +8,18 @@ pallav: - base - workspace - all + update: + - access clean: status: multiArgsCommands: remove: + - pallav - palak - param - darshan + arbitArgsCommands: + - rmi EOF source ./validate_command_access.sh @@ -29,19 +34,33 @@ testcase() { fi } +# ----- Fixed Args Commands ----- testcase "build base (valid)" build base testcase "build all (valid)" build all testcase "build base workspace (invalid)" build base workspace || true testcase "build (no arg, invalid)" build || true +testcase "update access (valid)" update access testcase "clean (zero-arg, valid)" clean testcase "clean with arg (invalid)" clean foo || true +testcase "status (zero-arg, valid)" status +testcase "status foo (invalid)" status foo || true + +# ----- Multi Args Commands ----- testcase "remove palak (valid)" remove palak testcase "remove param palak (valid, any order)" remove param palak testcase "remove palak param darshan (valid, any order)" remove palak param darshan +testcase "remove pallav (valid)" remove pallav -f testcase "remove (no arg, invalid)" remove || true testcase "remove foo (invalid)" remove foo || true testcase "remove palak palak (duplicate, invalid)" remove palak palak || true -testcase "status (zero-arg, valid)" status -testcase "status foo (invalid)" status foo || true +# ----- Arbitrary Args Commands ----- +testcase "rmi no args (valid)" rmi +testcase "rmi one arg (valid)" rmi image1 +testcase "rmi multiple args (valid)" rmi image1 image2 image3 +testcase "rmi with flag (valid)" rmi -f image1 image2 +testcase "rmi with only flag (valid)" rmi -f + +# ----- Disallowed command ----- +testcase "foo (invalid command)" foo image1 # should fail