|
3 | 3 | load "$BATS_TEST_DIRNAME/_test_helper.bash"
|
4 | 4 |
|
5 | 5 | SECRET_CONTENT="My secret content"
|
6 |
| -SECRET_CONTENT_ENC="U2FsdGVkX1/kkWK36bn3fbq5DY2d+JXL2YWoN/eoXA1XJZEk9JS7j/856rXK9gPn" |
| 6 | +SECRET_CONTENT_ENC="U2FsdGVkX1/6ilR0PmJpAyCF7iG3+k4aBwbgVd48WaQXznsg42nXbQrlWsf/qiCg" |
7 | 7 |
|
8 | 8 | @test "cleanup: transcrypt -f flush clears cached plaintext" {
|
9 | 9 | encrypt_named_file sensitive_file "$SECRET_CONTENT"
|
10 | 10 |
|
11 | 11 | # Confirm working copy file is decrypted
|
12 | 12 | run cat sensitive_file
|
13 |
| - [[ "$status" -eq 0 ]] |
14 |
| - [[ "${lines[0]}" = "$SECRET_CONTENT" ]] |
| 13 | + [ "$status" -eq 0 ] |
| 14 | + [ "${lines[0]}" = "$SECRET_CONTENT" ] |
15 | 15 |
|
16 | 16 | # Show all changes, caches plaintext due to `cachetextconv` setting
|
17 | 17 | run git log -p -- sensitive_file
|
18 |
| - [[ "$status" -eq 0 ]] |
| 18 | + [ "$status" -eq 0 ] |
19 | 19 | [[ "${output}" = *"+$SECRET_CONTENT" ]] # Check last line of patch
|
20 | 20 |
|
21 | 21 | # Look up notes ref to cached plaintext
|
22 |
| - [[ -f $BATS_TEST_DIRNAME/.git/refs/notes/textconv/crypt ]] |
| 22 | + [ -f $BATS_TEST_DIRNAME/.git/refs/notes/textconv/crypt ] |
23 | 23 | cached_plaintext_obj=$(cat "$BATS_TEST_DIRNAME/.git/refs/notes/textconv/crypt")
|
24 | 24 |
|
25 | 25 | # Confirm plaintext is cached
|
26 | 26 | run git show "$cached_plaintext_obj"
|
27 |
| - [[ "$status" -eq 0 ]] |
| 27 | + [ "$status" -eq 0 ] |
28 | 28 | [[ "${output}" = *"+$SECRET_CONTENT" ]] # Check last line of patch
|
29 | 29 |
|
30 | 30 | # Repack to force all objects into packs (which are trickier to clear)
|
31 | 31 | git repack
|
32 | 32 |
|
33 | 33 | # Flush credentials
|
34 | 34 | run ../transcrypt -f --yes
|
35 |
| - [[ "$status" -eq 0 ]] |
| 35 | + [ "$status" -eq 0 ] |
36 | 36 |
|
37 | 37 | # Confirm working copy file is encrypted
|
38 | 38 | run cat sensitive_file
|
39 |
| - [[ "$status" -eq 0 ]] |
40 |
| - [[ "${lines[0]}" = "$SECRET_CONTENT_ENC" ]] |
| 39 | + [ "$status" -eq 0 ] |
| 40 | + [ "${lines[0]}" = "$SECRET_CONTENT_ENC" ] |
41 | 41 |
|
42 | 42 | # Confirm show all changes shows encrypted content, not plaintext
|
43 | 43 | git log -p -- sensitive_file
|
44 | 44 | run git log -p -- sensitive_file
|
45 |
| - [[ "$status" -eq 0 ]] |
| 45 | + [ "$status" -eq 0 ] |
46 | 46 | [[ "${output}" = *"+$SECRET_CONTENT_ENC" ]] # Check last line of patch
|
47 | 47 |
|
48 | 48 | # Confirm plaintext cache ref was cleared
|
49 |
| - [[ ! -e $BATS_TEST_DIRNAME/.git/refs/notes/textconv/crypt ]] |
| 49 | + [ ! -e $BATS_TEST_DIRNAME/.git/refs/notes/textconv/crypt ] |
50 | 50 |
|
51 | 51 | # Confirm plaintext obj was truly cleared and is no longer visible
|
52 | 52 | run git show "$cached_plaintext_obj"
|
53 |
| - [[ "$status" -ne 0 ]] |
| 53 | + [ "$status" -ne 0 ] |
54 | 54 | }
|
55 | 55 |
|
56 | 56 | @test "cleanup: transcrypt --uninstall clears cached plaintext" {
|
57 | 57 | encrypt_named_file sensitive_file "$SECRET_CONTENT"
|
58 | 58 |
|
59 | 59 | # Confirm working copy file is decrypted
|
60 | 60 | run cat sensitive_file
|
61 |
| - [[ "$status" -eq 0 ]] |
62 |
| - [[ "${lines[0]}" = "$SECRET_CONTENT" ]] |
| 61 | + [ "$status" -eq 0 ] |
| 62 | + [ "${lines[0]}" = "$SECRET_CONTENT" ] |
63 | 63 |
|
64 | 64 | # Show all changes, caches plaintext due to `cachetextconv` setting
|
65 | 65 | run git log -p -- sensitive_file
|
66 |
| - [[ "$status" -eq 0 ]] |
| 66 | + [ "$status" -eq 0 ] |
67 | 67 | [[ "${output}" = *"+$SECRET_CONTENT" ]] # Check last line of patch
|
68 | 68 |
|
69 | 69 | # Look up notes ref to cached plaintext
|
70 |
| - [[ -f $BATS_TEST_DIRNAME/.git/refs/notes/textconv/crypt ]] |
| 70 | + [ -f $BATS_TEST_DIRNAME/.git/refs/notes/textconv/crypt ] |
71 | 71 | cached_plaintext_obj=$(cat "$BATS_TEST_DIRNAME/.git/refs/notes/textconv/crypt")
|
72 | 72 |
|
73 | 73 | # Confirm plaintext is cached
|
74 | 74 | run git show "$cached_plaintext_obj"
|
75 |
| - [[ "$status" -eq 0 ]] |
| 75 | + [ "$status" -eq 0 ] |
76 | 76 | [[ "${output}" = *"+$SECRET_CONTENT" ]] # Check last line of patch
|
77 | 77 |
|
78 | 78 | # Repack to force all objects into packs (which are trickier to clear)
|
79 | 79 | git repack
|
80 | 80 |
|
81 | 81 | # Uninstall
|
82 | 82 | run ../transcrypt --uninstall --yes
|
83 |
| - [[ "$status" -eq 0 ]] |
| 83 | + [ "$status" -eq 0 ] |
84 | 84 |
|
85 | 85 | # Confirm working copy file remains unencrypted (per uninstall contract)
|
86 | 86 | run cat sensitive_file
|
87 |
| - [[ "$status" -eq 0 ]] |
88 |
| - [[ "${lines[0]}" = "$SECRET_CONTENT" ]] |
| 87 | + [ "$status" -eq 0 ] |
| 88 | + [ "${lines[0]}" = "$SECRET_CONTENT" ] |
89 | 89 |
|
90 | 90 | # Confirm show all changes shows encrypted content, not plaintext
|
91 |
| - git log -p -- sensitive_file |
92 | 91 | run git log -p -- sensitive_file
|
93 |
| - [[ "$status" -eq 0 ]] |
| 92 | + [ "$status" -eq 0 ] |
94 | 93 | [[ "${output}" = *"+$SECRET_CONTENT_ENC" ]] # Check last line of patch
|
95 | 94 |
|
96 | 95 | # Confirm plaintext cache ref was cleared
|
97 |
| - [[ ! -e $BATS_TEST_DIRNAME/.git/refs/notes/textconv/crypt ]] |
| 96 | + [ ! -e $BATS_TEST_DIRNAME/.git/refs/notes/textconv/crypt ] |
98 | 97 |
|
99 | 98 | # Confirm plaintext obj was truly cleared and is no longer visible
|
100 | 99 | run git show "$cached_plaintext_obj"
|
101 |
| - [[ "$status" -ne 0 ]] |
| 100 | + [ "$status" -ne 0 ] |
102 | 101 | }
|
0 commit comments