summaryrefslogtreecommitdiff
path: root/internal/configfile/config_test.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2018-09-08 12:40:29 +0200
committerJakob Unterwurzacher2018-09-08 12:40:29 +0200
commit2bdf7d5172d3540606f098030e8ede7a3ad1dfdd (patch)
treea32afb70805dbc0c4915d0b800016ea3f31214b0 /internal/configfile/config_test.go
parent09d28c293e2f4142cda8dbfee0741aee7213748d (diff)
configfile: add LoadAndDecrypt wrapper
Callers that do not want to decrypt the masterkey should call plain Load(). https://github.com/rfjakob/gocryptfs/issues/258
Diffstat (limited to 'internal/configfile/config_test.go')
-rw-r--r--internal/configfile/config_test.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/internal/configfile/config_test.go b/internal/configfile/config_test.go
index b8ee150..0dd081c 100644
--- a/internal/configfile/config_test.go
+++ b/internal/configfile/config_test.go
@@ -11,7 +11,7 @@ import (
var testPw = []byte("test")
func TestLoadV1(t *testing.T) {
- _, _, err := Load("config_test/v1.conf", testPw)
+ _, _, err := LoadAndDecrypt("config_test/v1.conf", testPw)
if err == nil {
t.Errorf("Outdated v1 config file must fail to load but it didn't")
} else if testing.Verbose() {
@@ -24,7 +24,7 @@ func TestLoadV1(t *testing.T) {
func TestLoadV2(t *testing.T) {
t1 := time.Now()
- _, _, err := Load("config_test/v2.conf", testPw)
+ _, _, err := LoadAndDecrypt("config_test/v2.conf", testPw)
if err != nil {
t.Errorf("Could not load v2 config file: %v", err)
}
@@ -39,21 +39,21 @@ func TestLoadV2PwdError(t *testing.T) {
if !testing.Verbose() {
tlog.Warn.Enabled = false
}
- _, _, err := Load("config_test/v2.conf", []byte("wrongpassword"))
+ _, _, err := LoadAndDecrypt("config_test/v2.conf", []byte("wrongpassword"))
if err == nil {
t.Errorf("Loading with wrong password must fail but it didn't")
}
}
func TestLoadV2Feature(t *testing.T) {
- _, _, err := Load("config_test/PlaintextNames.conf", testPw)
+ _, _, err := LoadAndDecrypt("config_test/PlaintextNames.conf", testPw)
if err != nil {
t.Errorf("Could not load v2 PlaintextNames config file: %v", err)
}
}
func TestLoadV2StrangeFeature(t *testing.T) {
- _, _, err := Load("config_test/StrangeFeature.conf", testPw)
+ _, _, err := LoadAndDecrypt("config_test/StrangeFeature.conf", testPw)
if err == nil {
t.Errorf("Loading unknown feature must fail but it didn't")
} else if testing.Verbose() {
@@ -66,7 +66,7 @@ func TestCreateConfDefault(t *testing.T) {
if err != nil {
t.Fatal(err)
}
- _, c, err := Load("config_test/tmp.conf", testPw)
+ _, c, err := LoadAndDecrypt("config_test/tmp.conf", testPw)
if err != nil {
t.Fatal(err)
}
@@ -94,7 +94,7 @@ func TestCreateConfPlaintextnames(t *testing.T) {
if err != nil {
t.Fatal(err)
}
- _, c, err := Load("config_test/tmp.conf", testPw)
+ _, c, err := LoadAndDecrypt("config_test/tmp.conf", testPw)
if err != nil {
t.Fatal(err)
}
@@ -115,7 +115,7 @@ func TestCreateConfFileAESSIV(t *testing.T) {
if err != nil {
t.Fatal(err)
}
- _, c, err := Load("config_test/tmp.conf", testPw)
+ _, c, err := LoadAndDecrypt("config_test/tmp.conf", testPw)
if err != nil {
t.Fatal(err)
}