Add tests for every implemented command

This commit is contained in:
Loïc Guitaut
2015-09-10 11:57:24 +02:00
parent 860e5c7f9b
commit ca88f2bdce
21 changed files with 456 additions and 33 deletions

30
tests/service_export.bats Executable file
View File

@@ -0,0 +1,30 @@
#!/usr/bin/env bats
load test_helper
setup() {
export ECHO_DOCKER_COMMAND="false"
dokku "$PLUGIN_COMMAND_PREFIX:create" l >&2
}
teardown() {
export ECHO_DOCKER_COMMAND="false"
dokku --force "$PLUGIN_COMMAND_PREFIX:destroy" l >&2
}
@test "($PLUGIN_COMMAND_PREFIX:export) error when there are no arguments" {
run dokku "$PLUGIN_COMMAND_PREFIX:export"
assert_contains "${lines[*]}" "Please specify a name for the service"
}
@test "($PLUGIN_COMMAND_PREFIX:export) error when service does not exist" {
run dokku "$PLUGIN_COMMAND_PREFIX:export" not_existing_service
assert_contains "${lines[*]}" "service not_existing_service does not exist"
}
@test "($PLUGIN_COMMAND_PREFIX:export) success" {
export ECHO_DOCKER_COMMAND="true"
run dokku "$PLUGIN_COMMAND_PREFIX:export" l
password="$(cat "$PLUGIN_DATA_ROOT/l/PASSWORD")"
assert_output "docker exec dokku.postgres.l env PGPASSWORD=$password pg_dump -Fc --no-acl --no-owner -h localhost -U postgres -w l"
}