diff --git a/backend/deps.edn b/backend/deps.edn index 2c5183e78..b69343ea5 100644 --- a/backend/deps.edn +++ b/backend/deps.edn @@ -71,7 +71,8 @@ {:extra-paths ["test"] :extra-deps {io.github.cognitect-labs/test-runner - {:git/tag "v0.5.0" :git/sha "b3fd0d2"}} + {:git/tag "v0.5.1" :git/sha "dfb30dd"}} + :main-opts ["-m" "cognitect.test-runner"] :exec-fn cognitect.test-runner.api/test} :outdated diff --git a/backend/src/app/config.clj b/backend/src/app/config.clj index 1a856acd4..e80be8f80 100644 --- a/backend/src/app/config.clj +++ b/backend/src/app/config.clj @@ -11,7 +11,6 @@ [app.common.data :as d] [app.common.exceptions :as ex] [app.common.flags :as flags] - [app.common.logging :as l] [app.common.spec :as us] [app.common.version :as v] [app.util.time :as dt] @@ -359,11 +358,7 @@ "%version%"))) (defonce ^:dynamic config (read-config)) - -(defonce ^:dynamic flags - (let [flags (parse-flags config)] - (l/info :hint "flags initialized" :flags (str/join "," (map name flags))) - flags)) +(defonce ^:dynamic flags (parse-flags config)) (def deletion-delay (dt/duration {:days 7})) diff --git a/backend/src/app/main.clj b/backend/src/app/main.clj index 318b3a7df..fa098af9f 100644 --- a/backend/src/app/main.clj +++ b/backend/src/app/main.clj @@ -10,6 +10,7 @@ [app.common.logging :as l] [app.config :as cf] [app.util.time :as dt] + [cuerdas.core :as str] [integrant.core :as ig]) (:gen-class)) @@ -417,6 +418,7 @@ (ig/prep) (ig/init)))) (l/info :msg "welcome to penpot" + :flags (str/join "," (map name cf/flags)) :worker? (contains? cf/flags :backend-worker) :version (:full cf/version))) diff --git a/backend/test/app/services_profile_test.clj b/backend/test/app/services_profile_test.clj index 2e5b7d663..0c8aeaf82 100644 --- a/backend/test/app/services_profile_test.clj +++ b/backend/test/app/services_profile_test.clj @@ -301,10 +301,7 @@ (t/is (th/ex-of-code? error :email-as-password))))) (t/deftest test-email-change-request - (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 true})}] + (with-mocks [email-send-mock {:target 'app.emails/send! :return nil}] (let [profile (th/create-profile* 1) pool (:app.db/pool th/*system*) data {::th/type :request-email-change diff --git a/backend/test/app/test_helpers.clj b/backend/test/app/test_helpers.clj index 784f8e772..d32c6f093 100644 --- a/backend/test/app/test_helpers.clj +++ b/backend/test/app/test_helpers.clj @@ -50,6 +50,11 @@ (merge cf/defaults defaults) (us/conform ::cf/config))) +(def default-flags + [:enable-secure-session-cookies + :enable-email-verification + :enable-smtp]) + (defn state-init [next] (let [templates [{:id "test" @@ -57,8 +62,7 @@ :file-uri "test" :thumbnail-uri "test" :path (-> "app/test_files/template.penpot" io/resource fs/path)}] - config (-> main/system-config - (merge main/worker-config) + system (-> (merge main/system-config main/worker-config) (assoc-in [:app.redis/redis :uri] (:redis-uri config)) (assoc-in [:app.db/pool :uri] (:database-uri config)) (assoc-in [:app.db/pool :username] (:database-username config)) @@ -75,7 +79,6 @@ :app.auth.oidc/generic-provider :app.setup/builtin-templates :app.auth.oidc/routes - ;; :app.auth.ldap/provider :app.worker/executors-monitor :app.http.oauth/handler :app.notifications/handler @@ -86,16 +89,16 @@ :app.loggers.zmq/receiver :app.worker/cron :app.worker/worker)) - _ (ig/load-namespaces config) - system (-> (ig/prep config) + _ (ig/load-namespaces system) + system (-> (ig/prep system) (ig/init))] (try (binding [*system* system *pool* (:app.db/pool system)] - (mk/with-mocks [mock1 {:target 'app.rpc.commands.auth/derive-password - :return identity} - mock2 {:target 'app.rpc.commands.auth/verify-password - :return (fn [a b] {:valid (= a b)})}] + (with-redefs [app.config/flags (flags/parse flags/default default-flags (:flags config)) + app.config/config config + app.rpc.commands.auth/derive-password identity + app.rpc.commands.auth/verify-password (fn [a b] {:valid (= a b)})] (next))) (finally (ig/halt! system)))))