Add tests for every implemented command
This commit is contained in:
30
tests/service_export.bats
Executable file
30
tests/service_export.bats
Executable 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"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user