Skip to content

Commit

Permalink
Fixed integration tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
oniony committed Jun 29, 2016
1 parent 26ebe55 commit 15694e6
Show file tree
Hide file tree
Showing 44 changed files with 125 additions and 52 deletions.
1 change: 1 addition & 0 deletions tests/copy/copy_one_tag
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# setup

touch /tmp/tmsu/file1
tmsu tag /tmp/tmsu/file1 aubergine >|/tmp/tmsu/stdout 2>|/tmp/tmsu/stderr

# test
Expand Down
1 change: 1 addition & 0 deletions tests/copy/copy_tag_invalid_dest
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# setup

touch /tmp/tmsu/file1
tmsu tag /tmp/tmsu/file1 aubergine >|/tmp/tmsu/stdout 2>|/tmp/tmsu/stderr

# test
Expand Down
1 change: 1 addition & 0 deletions tests/copy/copy_tag_nonexistant_source
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# test

touch /tmp/tmsu/file1
tmsu copy aubergine eggplant >>/tmp/tmsu/stdout 2>>/tmp/tmsu/stderr

# verify
Expand Down
1 change: 1 addition & 0 deletions tests/copy/copy_tag_preexisting_dest
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# setup

touch /tmp/tmsu/file1
tmsu tag /tmp/tmsu/file1 aubergine eggplant >|/tmp/tmsu/stdout 2>|/tmp/tmsu/stderr

# test
Expand Down
1 change: 1 addition & 0 deletions tests/copy/copy_tag_to_itself
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

# setup

touch /tmp/tmsu/file1
tmsu tag /tmp/tmsu/file1 aubergine >|/tmp/tmsu/stdout 2>|/tmp/tmsu/stderr

# test
Expand Down
1 change: 1 addition & 0 deletions tests/copy/copy_two_tags
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# setup

touch /tmp/tmsu/file1
tmsu tag /tmp/tmsu/file1 aubergine >|/tmp/tmsu/stdout 2>|/tmp/tmsu/stderr

# test
Expand Down
18 changes: 11 additions & 7 deletions tests/dupes/list_dupes_in_database
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,23 @@

# setup

tmsu tag --tags="aubergine" /tmp/tmsu/file1 /tmp/tmsu/file3dupe1 >|/tmp/tmsu/stdout 2>|/tmp/tmsu/stderr
tmsu tag --recursive /tmp/tmsu/dir1 aubergine >>/tmp/tmsu/stdout 2>>/tmp/tmsu/stderr
echo dupe >/tmp/tmsu/file1
cp /tmp/tmsu/file1 /tmp/tmsu/file2
mkdir -p /tmp/tmsu/dir
cp /tmp/tmsu/file1 /tmp/tmsu/dir/file3
tmsu tag --tags="aubergine" /tmp/tmsu/file1 /tmp/tmsu/file2 >|/tmp/tmsu/stdout 2>|/tmp/tmsu/stderr
tmsu tag --recursive /tmp/tmsu/dir/file3 aubergine >>/tmp/tmsu/stdout 2>>/tmp/tmsu/stderr

# test

tmsu dupes >>/tmp/tmsu/stdout 2>>/tmp/tmsu/stderr
tmsu dupes >>/tmp/tmsu/stdout 2>>/tmp/tmsu/stderr

# verify

diff /tmp/tmsu/stderr - <<EOF
tmsu: new tag 'aubergine'
tmsu: '/tmp/tmsu/file3dupe1' is a duplicate
tmsu: '/tmp/tmsu/dir1/file1' is a duplicate
tmsu: '/tmp/tmsu/file2' is a duplicate
tmsu: '/tmp/tmsu/dir/file3' is a duplicate
EOF
if [[ $? -ne 0 ]]; then
exit 1
Expand All @@ -23,8 +27,8 @@ fi
diff /tmp/tmsu/stdout - <<EOF
Set of 3 duplicates:
/tmp/tmsu/file1
/tmp/tmsu/file3dupe1
/tmp/tmsu/dir1/file1
/tmp/tmsu/file2
/tmp/tmsu/dir/file3
EOF
if [[ $? -ne 0 ]]; then
exit 1
Expand Down
4 changes: 3 additions & 1 deletion tests/dupes/list_dupes_of_file
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

# setup

echo dupe >/tmp/tmsu/file1
cp /tmp/tmsu/file1 /tmp/tmsu/file2
tmsu tag --tags="aubergine" /tmp/tmsu/file1 >|/tmp/tmsu/stdout 2>|/tmp/tmsu/stderr

# test

tmsu dupes /tmp/tmsu/file3dupe1 >>/tmp/tmsu/stdout 2>>/tmp/tmsu/stderr
tmsu dupes /tmp/tmsu/file2 >>/tmp/tmsu/stdout 2>>/tmp/tmsu/stderr

# verify

Expand Down
7 changes: 5 additions & 2 deletions tests/dupes/list_dupes_of_file_recursively
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

# setup

echo dupe >/tmp/tmsu/file1
mkdir -p /tmp/tmsu/dir
cp /tmp/tmsu/file1 /tmp/tmsu/dir/file2
tmsu tag --tags="aubergine" /tmp/tmsu/file1 >|/tmp/tmsu/stdout 2>|/tmp/tmsu/stderr

# test

tmsu dupes --recursive /tmp/tmsu/dir1 >>/tmp/tmsu/stdout 2>>/tmp/tmsu/stderr
tmsu dupes --recursive /tmp/tmsu/dir >>/tmp/tmsu/stdout 2>>/tmp/tmsu/stderr

# verify

Expand All @@ -18,7 +21,7 @@ if [[ $? -ne 0 ]]; then
fi

diff /tmp/tmsu/stdout - <<EOF
/tmp/tmsu/dir1/file1:
/tmp/tmsu/dir/file2:
/tmp/tmsu/file1
EOF
if [[ $? -ne 0 ]]; then
Expand Down
1 change: 1 addition & 0 deletions tests/rename/rename_tag
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# setup

touch /tmp/tmsu/file1
tmsu tag /tmp/tmsu/file1 aubergine >|/tmp/tmsu/stdout 2>|/tmp/tmsu/stderr

# test
Expand Down
1 change: 1 addition & 0 deletions tests/rename/rename_tag_invalid_dest
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# setup

touch /tmp/tmsu/file1
tmsu tag /tmp/tmsu/file1 aubergine >|/tmp/tmsu/stdout 2>|/tmp/tmsu/stderr

# test
Expand Down
1 change: 1 addition & 0 deletions tests/rename/rename_tag_preexisting_dest
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# setup

touch /tmp/tmsu/file1
tmsu tag /tmp/tmsu/file1 aubergine eggplant >|/tmp/tmsu/stdout 2>|/tmp/tmsu/stderr

# test
Expand Down
1 change: 1 addition & 0 deletions tests/rename/rename_value
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# setup

touch /tmp/tmsu/file1
tmsu tag /tmp/tmsu/file1 year=2015 >|/tmp/tmsu/stdout 2>|/tmp/tmsu/stderr

# test
Expand Down
1 change: 1 addition & 0 deletions tests/rename/rename_value_invalid_dest
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# setup

touch /tmp/tmsu/file1
tmsu tag /tmp/tmsu/file1 year=2015 >|/tmp/tmsu/stdout 2>|/tmp/tmsu/stderr

# test
Expand Down
1 change: 1 addition & 0 deletions tests/rename/rename_value_preexisting_dest
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# setup

touch /tmp/tmsu/file1
tmsu tag /tmp/tmsu/file1 year=2015 year=2016 >|/tmp/tmsu/stdout 2>|/tmp/tmsu/stderr

# test
Expand Down
19 changes: 12 additions & 7 deletions tests/status/show_status_of_database
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@

# setup

mkdir -p /tmp/tmsu/dir
echo 1 >/tmp/tmsu/file1
echo 2 >/tmp/tmsu/file2
echo 3 >/tmp/tmsu/file3
echo 4 >/tmp/tmsu/dir/file4
touch /tmp/tmsu/file1 /tmp/tmsu/file2 /tmp/tmsu/file3 /tmp/tmsu/dir/file4
tmsu tag /tmp/tmsu/file1 aubergine >|/tmp/tmsu/stdout 2>|/tmp/tmsu/stderr
tmsu tag /tmp/tmsu/file2 aubergine >>/tmp/tmsu/stdout 2>>/tmp/tmsu/stderr
tmsu tag /tmp/tmsu/file4 aubergine >>/tmp/tmsu/stdout 2>>/tmp/tmsu/stderr
tmsu tag /tmp/tmsu/dir1 aubergine >>/tmp/tmsu/stdout 2>>/tmp/tmsu/stderr
tmsu tag /tmp/tmsu/file3 aubergine >>/tmp/tmsu/stdout 2>>/tmp/tmsu/stderr
tmsu tag /tmp/tmsu/dir aubergine >>/tmp/tmsu/stdout 2>>/tmp/tmsu/stderr
rm /tmp/tmsu/file2
echo eggplant >>/tmp/tmsu/file4
echo changed >>/tmp/tmsu/file3

# test

Expand All @@ -23,12 +29,11 @@ if [[ $? -ne 0 ]]; then
fi

diff /tmp/tmsu/stdout - <<EOF
T /tmp/tmsu/dir1
T /tmp/tmsu/dir
T /tmp/tmsu/file1
M /tmp/tmsu/file4
M /tmp/tmsu/file3
! /tmp/tmsu/file2
U /tmp/tmsu/dir1/file1
U /tmp/tmsu/dir1/file2
U /tmp/tmsu/dir/file4
EOF
if [[ $? -ne 0 ]]; then
exit 1
Expand Down
15 changes: 10 additions & 5 deletions tests/status/show_status_of_database_nonrecursively
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@

# setup

mkdir /tmp/tmsu/dir
echo 1 >/tmp/tmsu/file1
echo 2 >/tmp/tmsu/file2
echo 3 >/tmp/tmsu/file3
echo 4 >/tmp/tmsu/dir/file4
tmsu tag /tmp/tmsu/file1 aubergine >|/tmp/tmsu/stdout 2>|/tmp/tmsu/stderr
tmsu tag /tmp/tmsu/file2 aubergine >>/tmp/tmsu/stdout 2>>/tmp/tmsu/stderr
tmsu tag /tmp/tmsu/file4 aubergine >>/tmp/tmsu/stdout 2>>/tmp/tmsu/stderr
tmsu tag /tmp/tmsu/dir1 aubergine >>/tmp/tmsu/stdout 2>>/tmp/tmsu/stderr
tmsu tag /tmp/tmsu/file3 aubergine >>/tmp/tmsu/stdout 2>>/tmp/tmsu/stderr
tmsu tag /tmp/tmsu/dir aubergine >>/tmp/tmsu/stdout 2>>/tmp/tmsu/stderr
rm /tmp/tmsu/file2
echo eggplant >>/tmp/tmsu/file4
echo changed >>/tmp/tmsu/file3

# test

Expand All @@ -23,9 +28,9 @@ if [[ $? -ne 0 ]]; then
fi

diff /tmp/tmsu/stdout - <<EOF
T /tmp/tmsu/dir1
T /tmp/tmsu/dir
T /tmp/tmsu/file1
M /tmp/tmsu/file4
M /tmp/tmsu/file3
! /tmp/tmsu/file2
EOF
if [[ $? -ne 0 ]]; then
Expand Down
18 changes: 11 additions & 7 deletions tests/status/show_status_of_path
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,21 @@

# setup

mkdir -p /tmp/tmsu/dir
echo 1 >/tmp/tmsu/file1
echo 2 >/tmp/tmsu/file2
echo 3 >/tmp/tmsu/file3
echo 4 >/tmp/tmsu/dir/file4
tmsu tag /tmp/tmsu/file1 aubergine >|/tmp/tmsu/stdout 2>|/tmp/tmsu/stderr
tmsu tag /tmp/tmsu/file2 aubergine >>/tmp/tmsu/stdout 2>>/tmp/tmsu/stderr
tmsu tag /tmp/tmsu/file4 aubergine >>/tmp/tmsu/stdout 2>>/tmp/tmsu/stderr
tmsu tag /tmp/tmsu/dir1 aubergine >>/tmp/tmsu/stdout 2>>/tmp/tmsu/stderr
tmsu tag /tmp/tmsu/file3 aubergine >>/tmp/tmsu/stdout 2>>/tmp/tmsu/stderr
tmsu tag /tmp/tmsu/dir aubergine >>/tmp/tmsu/stdout 2>>/tmp/tmsu/stderr
rm /tmp/tmsu/file2
echo eggplant >>/tmp/tmsu/file4
echo changed >>/tmp/tmsu/file3

# test

tmsu status /tmp/tmsu/dir1 >>/tmp/tmsu/stdout 2>>/tmp/tmsu/stderr
tmsu status /tmp/tmsu/dir >>/tmp/tmsu/stdout 2>>/tmp/tmsu/stderr

# verify

Expand All @@ -23,9 +28,8 @@ if [[ $? -ne 0 ]]; then
fi

diff /tmp/tmsu/stdout - <<EOF
T /tmp/tmsu/dir1
U /tmp/tmsu/dir1/file1
U /tmp/tmsu/dir1/file2
T /tmp/tmsu/dir
U /tmp/tmsu/dir/file4
EOF
if [[ $? -ne 0 ]]; then
exit 1
Expand Down
1 change: 1 addition & 0 deletions tests/tags/explicit_only
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# setup

touch /tmp/tmsu/file1
tmsu tag /tmp/tmsu/file1 aubergine >|/tmp/tmsu/stdout 2>|/tmp/tmsu/stderr
tmsu imply aubergine vegetable >>/tmp/tmsu/stdout 2>>/tmp/tmsu/stderr

Expand Down
1 change: 1 addition & 0 deletions tests/tags/one_file_one_tag
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# setup

touch /tmp/tmsu/file1
tmsu tag /tmp/tmsu/file1 aubergine >|/tmp/tmsu/stdout 2>|/tmp/tmsu/stderr

# test
Expand Down
1 change: 1 addition & 0 deletions tests/tags/one_file_one_tag_count
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# setup

touch /tmp/tmsu/file1
tmsu tag /tmp/tmsu/file1 aubergine >|/tmp/tmsu/stdout 2>|/tmp/tmsu/stderr

# test
Expand Down
1 change: 1 addition & 0 deletions tests/tags/one_file_two_tags
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# setup

touch /tmp/tmsu/file1
tmsu tag /tmp/tmsu/file1 aubergine potato >|/tmp/tmsu/stdout 2>|/tmp/tmsu/stderr

# test
Expand Down
1 change: 1 addition & 0 deletions tests/tags/one_file_two_tags_count
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# setup

touch /tmp/tmsu/file1
tmsu tag /tmp/tmsu/file1 aubergine potato >|/tmp/tmsu/stdout 2>|/tmp/tmsu/stderr

# test
Expand Down
1 change: 1 addition & 0 deletions tests/tags/one_file_two_tags_list
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# setup

touch /tmp/tmsu/file1
tmsu tag /tmp/tmsu/file1 aubergine potato >|/tmp/tmsu/stdout 2>|/tmp/tmsu/stderr

# test
Expand Down
2 changes: 2 additions & 0 deletions tests/tags/two_files_one_tag
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

# setup

echo 1 >/tmp/tmsu/file1
echo 2 >/tmp/tmsu/file2
tmsu tag --tags="aubergine" /tmp/tmsu/file1 /tmp/tmsu/file2 >|/tmp/tmsu/stdout 2>|/tmp/tmsu/stderr

# test
Expand Down
2 changes: 2 additions & 0 deletions tests/tags/two_files_one_tag_count
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

# setup

echo 1 >/tmp/tmsu/file1
echo 2 >/tmp/tmsu/file2
tmsu tag --tags="aubergine" /tmp/tmsu/file1 /tmp/tmsu/file2 >|/tmp/tmsu/stdout 2>|/tmp/tmsu/stderr

# test
Expand Down
2 changes: 2 additions & 0 deletions tests/tags/two_files_two_tags
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

# setup

echo 1 >/tmp/tmsu/file1
echo 2 >/tmp/tmsu/file2
tmsu tag --tags="aubergine potato" /tmp/tmsu/file1 /tmp/tmsu/file2 >|/tmp/tmsu/stdout 2>|/tmp/tmsu/stderr

# test
Expand Down
2 changes: 2 additions & 0 deletions tests/tags/two_files_two_tags_count
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

# setup

echo 1 >/tmp/tmsu/file1
echo 2 >/tmp/tmsu/file2
tmsu tag --tags="aubergine potato" /tmp/tmsu/file1 /tmp/tmsu/file2 >|/tmp/tmsu/stdout 2>|/tmp/tmsu/stderr

# test
Expand Down
2 changes: 2 additions & 0 deletions tests/tags/two_files_two_tags_list
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

# setup

echo 1 >/tmp/tmsu/file1
echo 2 >/tmp/tmsu/file2
tmsu tag --tags="aubergine potato" /tmp/tmsu/file1 /tmp/tmsu/file2 >|/tmp/tmsu/stdout 2>|/tmp/tmsu/stderr

# test
Expand Down
1 change: 1 addition & 0 deletions tests/untag/unapply_all_tags
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# test

touch /tmp/tmsu/file1
tmsu tag /tmp/tmsu/file1 aubergine potato >|/tmp/tmsu/stdout 2>|/tmp/tmsu/stderr
tmsu tags --explicit /tmp/tmsu/file1 >>/tmp/tmsu/stdout 2>>/tmp/tmsu/stderr
tmsu untag --all /tmp/tmsu/file1 >>/tmp/tmsu/stdout 2>>/tmp/tmsu/stderr
Expand Down
2 changes: 2 additions & 0 deletions tests/untag/unapply_all_tags_from_multiple_files
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

# test

echo 1 >/tmp/tmsu/file1
echo 2 >/tmp/tmsu/file2
tmsu tag --tags="aubergine potato" /tmp/tmsu/file1 /tmp/tmsu/file2 >|/tmp/tmsu/stdout 2>|/tmp/tmsu/stderr
tmsu tags --explicit /tmp/tmsu/file1 /tmp/tmsu/file2 >>/tmp/tmsu/stdout 2>>/tmp/tmsu/stderr
tmsu untag --all /tmp/tmsu/file1 /tmp/tmsu/file2 >>/tmp/tmsu/stdout 2>>/tmp/tmsu/stderr
Expand Down

0 comments on commit 15694e6

Please sign in to comment.