1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2024-12-25 01:06:39 +00:00

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

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