From 1216ded14bb08793f44be6b48fb15febe8f0a02f Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Thu, 18 Jun 2015 21:28:50 +0200 Subject: [PATCH] Add integration test for key command --- cmd/restic/integration_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/cmd/restic/integration_test.go b/cmd/restic/integration_test.go index d097ada5d..a241bb203 100644 --- a/cmd/restic/integration_test.go +++ b/cmd/restic/integration_test.go @@ -86,6 +86,11 @@ func cmdFsck(t testing.TB) { OK(t, cmd.Execute(nil)) } +func cmdKey(t testing.TB, args ...string) { + cmd := &CmdKey{} + OK(t, cmd.Execute(args)) +} + func TestBackup(t *testing.T) { withTestEnvironment(t, func(env *testEnvironment) { datafile := filepath.Join("testdata", "backup-data.tar.gz") @@ -220,3 +225,19 @@ func TestIncrementalBackup(t *testing.T) { t.Logf("repository grown by %d bytes", stat3.size-stat2.size) }) } + +func TestKeyAddRemove(t *testing.T) { + withTestEnvironment(t, func(env *testEnvironment) { + datafile := filepath.Join("testdata", "backup-data.tar.gz") + fd, err := os.Open(datafile) + if os.IsNotExist(err) { + t.Skipf("unable to find data file %q, skipping", datafile) + return + } + OK(t, err) + OK(t, fd.Close()) + + cmdInit(t) + cmdKey(t, "list") + }) +}