libgocryptfs/tests/hkdf_sanity/sanity_test.go
Jakob Unterwurzacher 69d88505fd go mod: declare module version v2
Our git version is v2+ for some time now, but go.mod
still declared v1. Hopefully making both match makes
https://pkg.go.dev/github.com/rfjakob/gocryptfs/v2 work.

All the import paths have been fixed like this:

  find . -name \*.go | xargs sed -i s%github.com/rfjakob/gocryptfs/%github.com/rfjakob/gocryptfs/v2/%
2021-08-23 15:05:15 +02:00

35 lines
1004 B
Go

// We test two filesystems that have the "HKDF" feature flag in their config file
// set, but the actual file contents and names are encrypted with HKDF disabled.
// This test verifies that the "HKDF" feature flag in the config file takes effect.
package hkdf_sanity
import (
"io/ioutil"
"os"
"testing"
"github.com/rfjakob/gocryptfs/v2/tests/test_helpers"
)
func TestBrokenContent(t *testing.T) {
cDir := "broken_content"
pDir := test_helpers.TmpDir + "/" + cDir
test_helpers.MountOrFatal(t, cDir, pDir, "-extpass", "echo test", "-wpanic=false")
_, err := ioutil.ReadFile(pDir + "/status.txt")
if err == nil {
t.Error("this should fail")
}
test_helpers.UnmountPanic(pDir)
}
func TestBrokenNames(t *testing.T) {
cDir := "broken_names"
pDir := test_helpers.TmpDir + "/" + cDir
test_helpers.MountOrFatal(t, cDir, pDir, "-extpass", "echo test", "-wpanic=false")
_, err := os.Stat(pDir + "/status.txt")
if err == nil {
t.Error("this should fail")
}
test_helpers.UnmountPanic(pDir)
}