From 8ced867c4f2a26e00e32d7703fe13aa47d9df923 Mon Sep 17 00:00:00 2001 From: Pablo Mazzini Date: Sat, 9 Mar 2024 15:11:24 +0000 Subject: init_dir: use masterkey arg --- tests/cli/cli_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests/cli/cli_test.go') 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. -- cgit v1.2.3