From 44b2652f72402b5155f99b9550296c4337689491 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sun, 14 Oct 2012 10:32:24 +0200 Subject: o Tests for 'list' and 'list-versions'. o Adding support for -i for 'list'. --- test/app-list.bats | 102 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100755 test/app-list.bats (limited to 'test/app-list.bats') diff --git a/test/app-list.bats b/test/app-list.bats new file mode 100755 index 0000000..4e56f00 --- /dev/null +++ b/test/app-list.bats @@ -0,0 +1,102 @@ +#!/usr/bin/env bats +# vim: set filetype=sh: + +load utils + +@test "./app app list - all apps" { + mkzip "app-a" + app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-a -v 1.0 && + app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-a -v 1.1 && + app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-b -v 1.0 && + app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-b -i env-a -v 1.0 && + app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-b -i env-b -v 1.0 && + [ $status -eq 0 ] + + app app list; echo_lines + [ $status -eq 0 ] + [ "$output" = "Name Instance Version +app-a env-a 1.1 +app-a env-b 1.0 +app-b env-a 1.0 +app-b env-b 1.0 " ] + + app app list -P name -P instance -P version; echo_lines + [ $status -eq 0 ] + [ "$output" = "app-a:env-a:1.1 +app-a:env-b:1.0 +app-b:env-a:1.0 +app-b:env-b:1.0" ] +} + +@test "./app app list - -n filter" { + mkzip "app-a" + app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-a -v 1.0 && + app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-a -v 1.1 && + app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-b -v 1.0 && + app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-b -i env-a -v 1.0 && + app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-b -i env-b -v 1.0 && + [ $status -eq 0 ] + + app app list -n foo; echo_lines + [ $status -eq 0 ] + [ "$output" = "Name Instance Version " ] + + app app list -n app-a; echo_lines + [ $status -eq 0 ] + [ "$output" = "Name Instance Version +app-a env-a 1.1 +app-a env-b 1.0 " ] + + app app list -n app-a -P name -P instance -P version; echo_lines + [ $status -eq 0 ] + [ "$output" = "app-a:env-a:1.1 +app-a:env-b:1.0" ] +} + +@test "./app app list - -i filter" { + mkzip "app-a" + app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-a -v 1.0 && + app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-a -v 1.1 && + app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-b -v 1.0 && + app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-b -i env-a -v 1.0 && + app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-b -i env-b -v 1.0 && + [ $status -eq 0 ] + + app app list -i foo; echo_lines + [ $status -eq 0 ] + [ "$output" = "Name Instance Version " ] + + app app list -i env-a; echo_lines + [ $status -eq 0 ] + [ "$output" = "Name Instance Version +app-a env-a 1.1 +app-b env-a 1.0 " ] + + app app list -i env-a -P name -P instance -P version; echo_lines + [ $status -eq 0 ] + [ "$output" = "app-a:env-a:1.1 +app-b:env-a:1.0" ] +} + +@test "./app app list - -n + -i filter" { + mkzip "app-a" + app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-a -v 1.0 && + app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-a -v 1.1 && + app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-a -i env-b -v 1.0 && + app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-b -i env-a -v 1.0 && + app app install -r file -u $BATS_TEST_DIRNAME/data/app-a.zip -n app-b -i env-b -v 1.0 && + [ $status -eq 0 ] + + app app list -n foo -i bar; echo_lines + [ $status -eq 0 ] + [ "$output" = "Name Instance Version " ] + + app app list -n app-a -i env-a; echo_lines + [ $status -eq 0 ] + [ "$output" = "Name Instance Version +app-a env-a 1.1 " ] + + app app list -n app-a -i env-a -P name -P instance -P version; echo_lines + [ $status -eq 0 ] + [ "$output" = "app-a:env-a:1.1" ] +} -- cgit v1.2.3