Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dearchive に実行権限付与およびテストケース追加 #50

Merged
merged 2 commits into from
Jun 8, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/data/sample002/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# dearchive用テストのサンプルデータのセットです
100 changes: 100 additions & 0 deletions tests/data/sample002/sample002.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz
16
17
Fizz
19
Buzz
Fizz
22
23
Fizz
Buzz
26
Fizz
28
29
FizzBuzz
31
32
Fizz
34
Buzz
Fizz
37
38
Fizz
Buzz
41
Fizz
43
44
FizzBuzz
46
47
Fizz
49
Buzz
Fizz
52
53
Fizz
Buzz
56
Fizz
58
59
FizzBuzz
61
62
Fizz
64
Buzz
Fizz
67
68
Fizz
Buzz
71
Fizz
73
74
FizzBuzz
76
77
Fizz
79
Buzz
Fizz
82
83
Fizz
Buzz
86
Fizz
88
89
FizzBuzz
91
92
Fizz
94
Buzz
Fizz
97
98
Fizz
Buzz
Binary file added tests/data/sample002/sample002.txt.tar.gz.aes
Binary file not shown.
1 change: 1 addition & 0 deletions tests/data/sample002/sample002.txt.tar.gz.aes.passwd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
03ce0331cbd983f1689e1eea65561cac
Binary file not shown.
44 changes: 44 additions & 0 deletions tests/dearchive/arg_normal_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#shellcheck shell=sh

file_compare() {
cmp -s \
"${PATH_DIR_WORK}/sample002.txt" \
"${PATH_DIR_TEST}/data/sample002/sample002.txt" \
&& echo "successful" || echo "failure"
}

cleanup() {
rm -f "${PATH_DIR_WORK}/sample002.txt"
}

Describe 'dearchive with raw password'
After "cleanup"

It 'should dearchive file with status 0'
When call "${PATH_DIR_BIN}/dearchive" \
"${PATH_DIR_TEST}/data/sample002/sample002.txt.tar.gz.aes" \
"${PATH_DIR_WORK}" \
"${PATH_DIR_TEST}/data/sample002/sample002.txt.tar.gz.aes.passwd"

The output should include "共通鍵でファイルを復号しています ... OK"
The error should include "deprecated key derivation used." # TODO
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

あとで追跡できるように、備忘録 Ping #51

The status should be success
End
End

Describe 'dearchive with encrypted password'
After "cleanup"

It 'should dearchive file with status 0'
When call "${PATH_DIR_BIN}/dearchive" \
"${PATH_DIR_TEST}/data/sample002/sample002.txt.tar.gz.aes" \
"${PATH_DIR_WORK}" \
"${PATH_DIR_TEST}/data/sample002/sample002.txt.tar.gz.aes.passwd.enc" \
"${PATH_DIR_TEST}/.ssh/openssh/no_pass/id_rsa.pem"

The output should include "ファイルを復号しました。"
The output should include "共通鍵でファイルを復号しています ... OK"
The error should include "deprecated key derivation used." # TODO
The status should be success
End
End
10 changes: 10 additions & 0 deletions tests/dearchive/no_arg_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#shellcheck shell=sh

Describe 'dearchive with no arg'
It 'should print help with status 1'
When call "${PATH_DIR_BIN}/dearchive"

The output should include "使い方"
The status should be failure # status is 1-255
End
End