32 lines
1.5 KiB
Clojure
32 lines
1.5 KiB
Clojure
(ns dda.backup.management.domain-test
|
|
(:require
|
|
[clojure.test :refer [deftest is are testing run-tests]]
|
|
[clojure.spec.test.alpha :as st]
|
|
[dda.backup.management.domain :as cut]))
|
|
|
|
(st/instrument `cut/init-repo-command)
|
|
(st/instrument `cut/unlock-repo-command)
|
|
(st/instrument `cut/list-snapshot-command)
|
|
|
|
(deftest should-calculate-list-snapshot-command
|
|
(is (= [["restic" "-r" "repo/dir" "-v" "--cacert" "ca" "snapshots"]]
|
|
(cut/list-snapshot-command {:certificate-file "ca"
|
|
:restic-repository "repo"
|
|
:backup-path "dir"})))
|
|
(is (= [["restic" "-r" "repo/dir" "-v" "--password-file" "password" "snapshots"]]
|
|
(cut/list-snapshot-command {:password-file "password"
|
|
:restic-repository "repo"
|
|
:backup-path "dir"})))
|
|
(is (= [["restic" "-r" "repo/dir" "-v" "snapshots"]]
|
|
(cut/list-snapshot-command {:restic-repository "repo"
|
|
:backup-path "dir"}))))
|
|
|
|
(deftest should-calculate-init-repo-command
|
|
(is (= [["restic" "-r" "repo/dir" "-v" "init"]]
|
|
(cut/init-repo-command {:restic-repository "repo"
|
|
:backup-path "dir"}))))
|
|
|
|
(deftest should-calculate-unlock-repo-command
|
|
(is (= [["restic" "-r" "repo/dir" "-v" "--cleanup-cache" "unlock"]]
|
|
(cut/unlock-repo-command {:restic-repository "repo"
|
|
:backup-path "dir"}))))
|