diff options
author | Pablo Mazzini | 2024-03-09 15:11:24 +0000 |
---|---|---|
committer | rfjakob | 2024-03-13 10:42:53 +0100 |
commit | 8ced867c4f2a26e00e32d7703fe13aa47d9df923 (patch) | |
tree | fdbd0dd9adab015503e8d728ec71b59716a82768 /tests | |
parent | 0dfa7f8fadfa200c62f8ed9d3d08f745aa182f5b (diff) |
init_dir: use masterkey arg
Diffstat (limited to 'tests')
-rw-r--r-- | tests/cli/cli_test.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/cli/cli_test.go b/tests/cli/cli_test.go index 94a8b16..686d14c 100644 --- a/tests/cli/cli_test.go +++ b/tests/cli/cli_test.go @@ -2,6 +2,8 @@ package cli import ( + "bytes" + "encoding/hex" "fmt" "io/ioutil" "os" @@ -97,6 +99,19 @@ func TestInitReverse(t *testing.T) { } } +// Test -init with -masterkey +func TestInitMasterkey(t *testing.T) { + var testMk = make([]byte, 32) + dir := test_helpers.InitFS(t, fmt.Sprintf("-masterkey=%s", hex.EncodeToString(testMk))) + m, _, err := configfile.LoadAndDecrypt(dir+"/"+configfile.ConfDefaultName, testPw) + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(testMk, m) { + t.Error("masterkey does not match") + } +} + // testPasswd changes the password from "test" to "test" using // the -extpass method, then from "test" to "newpasswd" using the // stdin method. |