From dfd9830ff859f23b0fa903a18237fca89a4d9306 Mon Sep 17 00:00:00 2001 From: ge Date: Tue, 17 May 2022 00:04:03 +0300 Subject: [PATCH] feat: Update tests --- tests/files/{bad_syntax.plan => bad_syntax.sh} | 0 tests/files/{basic.plan => basic.sh} | 0 .../{empty_script.plan => empty_script.sh} | 0 .../{empty_sources.plan => empty_sources.sh} | 0 .../{empty_targets.plan => empty_targets.sh} | 0 ...e_targets.plan => multiple_file_targets.sh} | 0 .../{no_file_target.plan => no_file_target.sh} | 0 ...cheme.plan => unsupported_source_scheme.sh} | 0 ...cheme.plan => unsupported_target_scheme.sh} | 0 tests/parse_uri.bats | 6 +++--- tests/source_script.bats | 18 +++++++++--------- 11 files changed, 12 insertions(+), 12 deletions(-) rename tests/files/{bad_syntax.plan => bad_syntax.sh} (100%) rename tests/files/{basic.plan => basic.sh} (100%) rename tests/files/{empty_script.plan => empty_script.sh} (100%) rename tests/files/{empty_sources.plan => empty_sources.sh} (100%) rename tests/files/{empty_targets.plan => empty_targets.sh} (100%) rename tests/files/{multiple_file_targets.plan => multiple_file_targets.sh} (100%) rename tests/files/{no_file_target.plan => no_file_target.sh} (100%) rename tests/files/{unsupported_source_scheme.plan => unsupported_source_scheme.sh} (100%) rename tests/files/{unsupported_target_scheme.plan => unsupported_target_scheme.sh} (100%) diff --git a/tests/files/bad_syntax.plan b/tests/files/bad_syntax.sh similarity index 100% rename from tests/files/bad_syntax.plan rename to tests/files/bad_syntax.sh diff --git a/tests/files/basic.plan b/tests/files/basic.sh similarity index 100% rename from tests/files/basic.plan rename to tests/files/basic.sh diff --git a/tests/files/empty_script.plan b/tests/files/empty_script.sh similarity index 100% rename from tests/files/empty_script.plan rename to tests/files/empty_script.sh diff --git a/tests/files/empty_sources.plan b/tests/files/empty_sources.sh similarity index 100% rename from tests/files/empty_sources.plan rename to tests/files/empty_sources.sh diff --git a/tests/files/empty_targets.plan b/tests/files/empty_targets.sh similarity index 100% rename from tests/files/empty_targets.plan rename to tests/files/empty_targets.sh diff --git a/tests/files/multiple_file_targets.plan b/tests/files/multiple_file_targets.sh similarity index 100% rename from tests/files/multiple_file_targets.plan rename to tests/files/multiple_file_targets.sh diff --git a/tests/files/no_file_target.plan b/tests/files/no_file_target.sh similarity index 100% rename from tests/files/no_file_target.plan rename to tests/files/no_file_target.sh diff --git a/tests/files/unsupported_source_scheme.plan b/tests/files/unsupported_source_scheme.sh similarity index 100% rename from tests/files/unsupported_source_scheme.plan rename to tests/files/unsupported_source_scheme.sh diff --git a/tests/files/unsupported_target_scheme.plan b/tests/files/unsupported_target_scheme.sh similarity index 100% rename from tests/files/unsupported_target_scheme.plan rename to tests/files/unsupported_target_scheme.sh diff --git a/tests/parse_uri.bats b/tests/parse_uri.bats index e50c016..ef5579c 100644 --- a/tests/parse_uri.bats +++ b/tests/parse_uri.bats @@ -119,13 +119,13 @@ setup() { [ "$fragment" == '' ] } -@test "sqlite:///path" { +@test "sqlite:///database.db" { . uri.sh - parse_uri 'sqlite:///path' + parse_uri 'sqlite:///database.db' [ "$scheme" == 'sqlite' ] [ "$hostname" == '' ] [ "$port" == '' ] - [ "$path" == '/path' ] + [ "$path" == '/database.db' ] [ "$username" == '' ] [ "$password" == '' ] [ "$query" == '' ] diff --git a/tests/source_script.bats b/tests/source_script.bats index 100897d..475077d 100644 --- a/tests/source_script.bats +++ b/tests/source_script.bats @@ -17,50 +17,50 @@ setup() { @test "Bad script syntax" { . 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' } @test "Empty script" { . 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' } @test "Empty sources array" { . 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' } @test "Empty targets array" { . 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' } @test "No targets with 'file' URI scheme" { . 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." } @test "Unsuported source scheme" { . 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' } @test "Unsuported target scheme" { . 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' } @test "Set __main_target" { . source.sh . 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_path" == '/etc/lvm/backup' ] } @@ -68,7 +68,7 @@ setup() { @test "Set __main_target from multiple 'file' targets" { . source.sh . 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_path" == '/etc/lvm/backup' ] }