Add some srepl helpers for resend email verification

This commit is contained in:
Andrey Antukh 2022-09-20 14:13:19 +02:00
parent 3c2ba92f6c
commit c4aba025c4
4 changed files with 92 additions and 36 deletions

View file

@ -97,7 +97,7 @@
:profile-id (:id profile)}
out (th/query! data)]
;; (th/print-result! out)
#_(th/print-result! out)
(t/is (nil? (:error out)))
(let [result (:result out)]
@ -338,22 +338,21 @@
(t/deftest test-email-change-request-without-smtp
(with-mocks [email-send-mock {:target 'app.emails/send! :return nil}
cfg-get-mock {:target 'app.config/get
:return (th/mock-config-get-with
{:smtp-enabled false})}]
(let [profile (th/create-profile* 1)
pool (:app.db/pool th/*system*)
data {::th/type :request-email-change
:profile-id (:id profile)
:email "user1@example.com"}]
(with-mocks [email-send-mock {:target 'app.emails/send! :return nil}]
(with-redefs [app.config/flags #{}]
(let [profile (th/create-profile* 1)
pool (:app.db/pool th/*system*)
data {::th/type :request-email-change
:profile-id (:id profile)
:email "user1@example.com"}]
;; without complaints
(let [out (th/mutation! data)
res (:result out)]
(t/is (= {:changed true} res))
(let [mock (deref email-send-mock)]
(t/is (false? (:called? mock))))))))
(let [out (th/mutation! data)
res (:result out)]
;; (th/print-result! out)
(t/is (= {:changed true} res))
(let [mock (deref email-send-mock)]
(t/is (false? (:called? mock)))))))))
(t/deftest test-request-profile-recovery