summaryrefslogtreecommitdiff
path: root/tests/trezor
diff options
context:
space:
mode:
authorPavol Rusnak2019-12-27 22:27:57 +0100
committerrfjakob2019-12-28 19:50:49 +0100
commit1364b44ae356da31e24e5605fe73a307e9d6fb03 (patch)
tree22042a87f6a24f6768b3c6cd0ea319db26124d63 /tests/trezor
parent7dda2363e1f8d30d5ebce5b6279452a2cf1bb77a (diff)
remove Trezor support
Diffstat (limited to 'tests/trezor')
-rw-r--r--tests/trezor/trezor_test.go58
1 files changed, 0 insertions, 58 deletions
diff --git a/tests/trezor/trezor_test.go b/tests/trezor/trezor_test.go
deleted file mode 100644
index 5e071fc..0000000
--- a/tests/trezor/trezor_test.go
+++ /dev/null
@@ -1,58 +0,0 @@
-package trezor
-
-// Test operations with "-trezor".
-// See also the "cli" package - the tests there are very similar.
-
-import (
- "os/exec"
- "runtime"
- "testing"
-
- "github.com/rfjakob/gocryptfs/internal/configfile"
- "github.com/rfjakob/gocryptfs/internal/exitcodes"
-
- "github.com/rfjakob/gocryptfs/tests/test_helpers"
-)
-
-func isTrezorConnected() bool {
- if runtime.GOOS != "linux" {
- return false
- }
- c := exec.Command("lsusb", "-d", "534c:0001")
- err := c.Run()
- if err != nil {
- return false
- }
- return true
-}
-
-// Test -init with -trezor
-func TestInitTrezor(t *testing.T) {
- if !isTrezorConnected() {
- t.Skip("No Trezor device connected")
- }
- t.Log("Trying gocryptfs -init -trezor ...")
- // vvvvvvvvvvvvv disable -extpass
- dir := test_helpers.InitFS(t, "-trezor", "-extpass", "")
- // The freshly created config file should have the Trezor feature flag set.
- c, err := configfile.Load(dir + "/" + configfile.ConfDefaultName)
- if err != nil {
- t.Fatal(err)
- }
- if !c.IsFeatureFlagSet(configfile.FlagTrezor) {
- t.Error("Trezor flag should be set but is not")
- }
- if len(c.TrezorPayload) != 32 {
- t.Errorf("TrezorPayload has wrong length: %d", len(c.TrezorPayload))
- }
-}
-
-// Test using -trezor together with -extpass. Should fail with code 1 (usage error).
-func TestTrezorExtpass(t *testing.T) {
- cmd := exec.Command(test_helpers.GocryptfsBinary, "-init", "-trezor", "-extpass", "foo", "/tmp")
- err := cmd.Run()
- exitCode := test_helpers.ExtractCmdExitCode(err)
- if exitCode != exitcodes.Usage {
- t.Errorf("wrong exit code: want %d, have %d", exitcodes.Usage, exitCode)
- }
-}