summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJakob Unterwurzacher2018-06-25 21:55:20 +0200
committerJakob Unterwurzacher2018-07-01 20:56:22 +0200
commit8e5ca7299a3292cae64418aaf875819c2cca01f5 (patch)
treeecaf407e80e2acd2faa34ccfca859d7732f4eaed /tests
parent4bf02f476034f6a30a378769cda323e0ce5ae59f (diff)
trezor: exit with usage error if used together with -extpass
Using an external program for the Trezor PIN is not supported at the moment.
Diffstat (limited to 'tests')
-rw-r--r--tests/trezor/trezor_test.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/trezor/trezor_test.go b/tests/trezor/trezor_test.go
index ba468d9..65f1f15 100644
--- a/tests/trezor/trezor_test.go
+++ b/tests/trezor/trezor_test.go
@@ -9,6 +9,7 @@ import (
"testing"
"github.com/rfjakob/gocryptfs/internal/configfile"
+ "github.com/rfjakob/gocryptfs/internal/exitcodes"
"github.com/rfjakob/gocryptfs/tests/test_helpers"
)
@@ -42,3 +43,13 @@ func TestInitTrezor(t *testing.T) {
t.Error("Trezor flag should be set but is not")
}
}
+
+// 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)
+ }
+}