feat: Update tests

This commit is contained in:
ge 2022-05-17 00:04:03 +03:00
parent bd616ba4fc
commit dfd9830ff8
11 changed files with 12 additions and 12 deletions

View File

@ -119,13 +119,13 @@ setup() {
[ "$fragment" == '' ] [ "$fragment" == '' ]
} }
@test "sqlite:///path" { @test "sqlite:///database.db" {
. uri.sh . uri.sh
parse_uri 'sqlite:///path' parse_uri 'sqlite:///database.db'
[ "$scheme" == 'sqlite' ] [ "$scheme" == 'sqlite' ]
[ "$hostname" == '' ] [ "$hostname" == '' ]
[ "$port" == '' ] [ "$port" == '' ]
[ "$path" == '/path' ] [ "$path" == '/database.db' ]
[ "$username" == '' ] [ "$username" == '' ]
[ "$password" == '' ] [ "$password" == '' ]
[ "$query" == '' ] [ "$query" == '' ]

View File

@ -17,50 +17,50 @@ setup() {
@test "Bad script syntax" { @test "Bad script syntax" {
. source.sh . source.sh
run source_script $DIR/files/bad_syntax.plan run source_script $DIR/files/bad_syntax.sh
assert_output --partial 'Error: Please check your syntax' assert_output --partial 'Error: Please check your syntax'
} }
@test "Empty script" { @test "Empty script" {
. source.sh . source.sh
run source_script $DIR/files/empty_script.plan run source_script $DIR/files/empty_script.sh
assert_output --partial 'Error: sources array is not set' assert_output --partial 'Error: sources array is not set'
} }
@test "Empty sources array" { @test "Empty sources array" {
. source.sh . source.sh
run source_script $DIR/files/empty_sources.plan run source_script $DIR/files/empty_sources.sh
assert_output --partial 'Error: sources array is not set' assert_output --partial 'Error: sources array is not set'
} }
@test "Empty targets array" { @test "Empty targets array" {
. source.sh . source.sh
run source_script $DIR/files/empty_targets.plan run source_script $DIR/files/empty_targets.sh
assert_output --partial 'Error: targets array is not set' assert_output --partial 'Error: targets array is not set'
} }
@test "No targets with 'file' URI scheme" { @test "No targets with 'file' URI scheme" {
. source.sh . source.sh
run source_script $DIR/files/no_file_target.plan run source_script $DIR/files/no_file_target.sh
assert_output --partial "Error: 'file' scheme is not set in targets. You must provide one or more targets with 'file' scheme." assert_output --partial "Error: 'file' scheme is not set in targets. You must provide one or more targets with 'file' scheme."
} }
@test "Unsuported source scheme" { @test "Unsuported source scheme" {
. source.sh . source.sh
run source_script $DIR/files/unsupported_source_scheme.plan run source_script $DIR/files/unsupported_source_scheme.sh
assert_output --partial 'Error: Unsupported URI scheme: mongo' assert_output --partial 'Error: Unsupported URI scheme: mongo'
} }
@test "Unsuported target scheme" { @test "Unsuported target scheme" {
. source.sh . source.sh
run source_script $DIR/files/unsupported_target_scheme.plan run source_script $DIR/files/unsupported_target_scheme.sh
assert_output --partial 'Error: Unsupported URI scheme: scp' assert_output --partial 'Error: Unsupported URI scheme: scp'
} }
@test "Set __main_target" { @test "Set __main_target" {
. source.sh . source.sh
. uri.sh # for parse_uri() . uri.sh # for parse_uri()
source_script $DIR/files/basic.plan source_script $DIR/files/basic.sh
[ "$__main_target" == 'file:/etc/lvm/backup' ] [ "$__main_target" == 'file:/etc/lvm/backup' ]
[ "$__main_target_path" == '/etc/lvm/backup' ] [ "$__main_target_path" == '/etc/lvm/backup' ]
} }
@ -68,7 +68,7 @@ setup() {
@test "Set __main_target from multiple 'file' targets" { @test "Set __main_target from multiple 'file' targets" {
. source.sh . source.sh
. uri.sh # for parse_uri() . uri.sh # for parse_uri()
source_script $DIR/files/multiple_file_targets.plan source_script $DIR/files/multiple_file_targets.sh
[ "$__main_target" == 'file:///etc/lvm/backup' ] [ "$__main_target" == 'file:///etc/lvm/backup' ]
[ "$__main_target_path" == '/etc/lvm/backup' ] [ "$__main_target_path" == '/etc/lvm/backup' ]
} }