Add integration test for key command

This commit is contained in:
Alexander Neumann 2015-06-18 21:28:50 +02:00
parent e2563b3eca
commit 1216ded14b
1 changed files with 21 additions and 0 deletions

View File

@ -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")
})
}