Пример #1
0
func TestGenerateSecrets(t *testing.T) {
	backend := memoryBackend.New()
	secrets, err := GenerateSecrets(backend)
	defer ZeroSecrets(secrets)
	if err != nil {
		t.Error(err)
	}
}
Пример #2
0
func TestWriteReadBackupSet(t *testing.T) {
	backend := memoryBackend.New()
	backend.WriteBackupSet("foo", "bar", []byte("barbazquux"))
	data, err := backend.ReadBackupSet("foo", "bar")
	if err != nil {
		t.Fatal(err)
	}
	if !bytes.Equal(data, []byte("barbazquux")) {
		t.Fatal("Could not read back written backup set")
	}
}
Пример #3
0
func TestFileInfo(t *testing.T) {
	secrets, err := generateSecrets()
	defer ZeroSecrets(secrets)
	if err != nil {
		t.Fatal(err)
	}
	backend := memoryBackend.New()
	backupSet, err := EnsureBackupSet(backend, secrets, "foo")
	if err != nil {
		t.Fatal(err)
	}
	ProcessPath(backupSet, ".")
}
Пример #4
0
func TestBackupSet(t *testing.T) {
	backend := memoryBackend.New()
	secrets, err := GenerateSecrets(backend)
	defer ZeroSecrets(secrets)
	if err != nil {
		t.Fatal(err)
	}
	set, err := EnsureBackupSet(backend, secrets, "foo")
	if err != nil {
		t.Fatal(err)
	}
	if set == nil {
		t.Fatal("nil")
	}
}