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

30 lines
1.4 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/list-snapshot-command)
(deftest should-calculate-init-repo-command
(is (= [["restic" "-r" "repo/dir" "--cacert" "ca" "-v" "init"]]
(cut/init-repo-command {:certificate-file "ca"
:restic-repository "repo"
:backup-path "dir"})))
(is (= [["restic" "-r" "repo/dir" "-v" "init"]]
(cut/init-repo-command {:restic-repository "repo"
:backup-path "dir"}))))
(deftest should-calculate-list-snapshot-command
(is (= [["restic" "-r" "repo/dir" "--cacert" "ca" "-v" "snapshots"]]
(cut/list-snapshot-command {:certificate-file "ca"
:restic-repository "repo"
:backup-path "dir"})))
(is (= [["restic" "-r" "repo/dir" "--password-file" "password" "-v" "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"}))))