dda-backup/test/dda/backup/management/domain_test.clj

33 lines
1.5 KiB
Clojure
Raw Normal View History

2024-08-16 10:32:59 +00:00
(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)
2024-08-16 14:29:19 +00:00
(st/instrument `cut/unlock-repo-command)
2024-08-16 12:40:35 +00:00
(st/instrument `cut/list-snapshot-command)
2024-08-16 10:32:59 +00:00
2024-08-16 12:40:35 +00:00
(deftest should-calculate-list-snapshot-command
2024-08-16 14:29:19 +00:00
(is (= [["restic" "-r" "repo/dir" "-v" "--cacert" "ca" "snapshots"]]
2024-08-16 12:40:35 +00:00
(cut/list-snapshot-command {:certificate-file "ca"
:restic-repository "repo"
:backup-path "dir"})))
2024-08-16 14:29:19 +00:00
(is (= [["restic" "-r" "repo/dir" "-v" "--password-file" "password" "snapshots"]]
2024-08-16 12:40:35 +00:00
(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"}))))
2024-08-16 14:29:19 +00:00
(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"}))))