From b701f6baee1b2b1720c41dbd5a556ca65b9a2180 Mon Sep 17 00:00:00 2001 From: Chai Feng Date: Sat, 19 Oct 2019 12:34:50 +0200 Subject: [PATCH] Add two tests for ufw-docker--delete --- test/ufw-docker.test.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/ufw-docker.test.sh b/test/ufw-docker.test.sh index 2579fe2..35b3919 100755 --- a/test/ufw-docker.test.sh +++ b/test/ufw-docker.test.sh @@ -430,3 +430,29 @@ test-ufw-docker--list-number() { test-ufw-docker--list-number-assert() { sed -e 's/^\[[[:blank:]]*\([[:digit:]]\+\)\].*/\1/' } + + +test-ufw-docker--delete-empty-result() { + @mock ufw-docker--list-number webapp 80 tcp === @stdout "" + @mock sort -rn + + load-ufw-docker-function ufw-docker--delete + ufw-docker--delete webapp 80 tcp +} +test-ufw-docker--delete-empty-result-assert() { + @do-nothing +} + + +test-ufw-docker--delete-all() { + @mock ufw-docker--list-number webapp 80 tcp === @stdout 5 8 9 + @mock sort -rn + + load-ufw-docker-function ufw-docker--delete + ufw-docker--delete webapp 80 tcp +} +test-ufw-docker--delete-all-assert() { + ufw delete 5 + ufw delete 8 + ufw delete 9 +}