♻️ Refactor backend tests directory tree

This commit is contained in:
Andrey Antukh 2022-11-03 10:35:19 +01:00 committed by Andrés Moya
parent 1298956d92
commit fa93e5a1a7
24 changed files with 68 additions and 73 deletions

View file

@ -63,7 +63,7 @@
;; --- Development Stuff
(defn- run-tests
([] (run-tests #"^app.*-test$"))
([] (run-tests #"^app-tests.test-.*$"))
([o]
(repl/refresh)
(cond

View file

@ -4,12 +4,12 @@
;;
;; Copyright (c) KALEIDOS INC
(ns app.bounce-handling-test
(ns app-tests.test-bounce-handling
(:require
[app-tests.test-helpers :as th]
[app.db :as db]
[app.emails :as emails]
[app.http.awsns :as awsns]
[app.test-helpers :as th]
[app.tokens :as tokens]
[app.util.time :as dt]
[clojure.pprint :refer [pprint]]

View file

@ -4,13 +4,13 @@
;;
;; Copyright (c) KALEIDOS INC
(ns app.emails-test
(ns app-tests.test-email-sending
(:require
[clojure.test :as t]
[promesa.core :as p]
[app-tests.test-helpers :as th]
[app.db :as db]
[app.emails :as emails]
[app.test-helpers :as th]))
[clojure.test :as t]
[promesa.core :as p]))
(t/use-fixtures :once th/state-init)
(t/use-fixtures :each th/database-reset)

View file

Before

Width:  |  Height:  |  Size: 305 KiB

After

Width:  |  Height:  |  Size: 305 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Before After
Before After

View file

@ -4,7 +4,7 @@
;;
;; Copyright (c) KALEIDOS INC
(ns app.test-helpers
(ns app-tests.test-helpers
(:require
[app.common.data :as d]
[app.common.flags :as flags]
@ -65,7 +65,7 @@
:name "test"
:file-uri "test"
:thumbnail-uri "test"
:path (-> "app/test_files/template.penpot" io/resource fs/path)}]
:path (-> "app_tests/test_files/template.penpot" io/resource fs/path)}]
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))

View file

@ -4,14 +4,14 @@
;;
;; Copyright (c) KALEIDOS INC
(ns app.services-files-test
(ns app-tests.test-rpc-file
(:require
[app-tests.test-helpers :as th]
[app.common.uuid :as uuid]
[app.db :as db]
[app.db.sql :as sql]
[app.http :as http]
[app.storage :as sto]
[app.test-helpers :as th]
[app.util.time :as dt]
[clojure.test :as t]
[datoteka.core :as fs]))
@ -124,7 +124,7 @@
(t/deftest file-gc-task
(letfn [(create-file-media-object [{:keys [profile-id file-id]}]
(let [mfile {:filename "sample.jpg"
:path (th/tempfile "app/test_files/sample.jpg")
:path (th/tempfile "app_tests/test_files/sample.jpg")
:mtype "image/jpeg"
:size 312043}
params {::th/type :upload-file-media-object

View file

@ -4,13 +4,13 @@
;;
;; Copyright (c) KALEIDOS INC
(ns app.services-fonts-test
(ns app-tests.test-rpc-font
(:require
[app-tests.test-helpers :as th]
[app.common.uuid :as uuid]
[app.db :as db]
[app.http :as http]
[app.storage :as sto]
[app.test-helpers :as th]
[clojure.test :as t]
[datoteka.fs :as fs]
[datoteka.io :as io]))
@ -24,7 +24,7 @@
proj-id (:default-project-id prof)
font-id (uuid/custom 10 1)
ttfdata (-> (io/resource "app/test_files/font-1.ttf")
ttfdata (-> (io/resource "app_tests/test_files/font-1.ttf")
io/input-stream
io/read-as-bytes)
@ -59,7 +59,7 @@
proj-id (:default-project-id prof)
font-id (uuid/custom 10 1)
data (-> (io/resource "app/test_files/font-1.woff")
data (-> (io/resource "app_tests/test_files/font-1.woff")
io/input-stream
io/read-as-bytes)

View file

@ -4,16 +4,16 @@
;;
;; Copyright (c) KALEIDOS INC
(ns app.services-management-test
(ns app-tests.test-rpc-management
(:require
[app-tests.test-storage :refer [configure-storage-backend]]
[app-tests.test-helpers :as th]
[app.common.uuid :as uuid]
[app.db :as db]
[app.http :as http]
[app.storage :as sto]
[app.test-helpers :as th]
[app.storage-test :refer [configure-storage-backend]]
[clojure.test :as t]
[buddy.core.bytes :as b]
[clojure.test :as t]
[datoteka.core :as fs]))
(t/use-fixtures :once th/state-init)

View file

@ -4,12 +4,12 @@
;;
;; Copyright (c) KALEIDOS INC
(ns app.services-media-test
(ns app-tests.test-rpc-media
(:require
[app-tests.test-helpers :as th]
[app.common.uuid :as uuid]
[app.db :as db]
[app.storage :as sto]
[app.test-helpers :as th]
[clojure.test :as t]
[datoteka.core :as fs]))
@ -60,7 +60,7 @@
:project-id (:default-project-id prof)
:is-shared false})
mfile {:filename "sample.jpg"
:path (th/tempfile "app/test_files/sample.jpg")
:path (th/tempfile "app_tests/test_files/sample.jpg")
:mtype "image/jpeg"
:size 312043}
@ -99,7 +99,7 @@
:project-id (:default-project-id prof)
:is-shared false})
mfile {:filename "sample.jpg"
:path (th/tempfile "app/test_files/sample.jpg")
:path (th/tempfile "app_tests/test_files/sample.jpg")
:mtype "image/jpeg"
:size 312043}

View file

@ -4,14 +4,14 @@
;;
;; Copyright (c) KALEIDOS INC
(ns app.services-profile-test
(ns app-tests.test-rpc-profile
(:require
[app-tests.test-helpers :as th]
[app.common.uuid :as uuid]
[app.config :as cf]
[app.db :as db]
[app.rpc.commands.auth :as cauth]
[app.rpc.mutations.profile :as profile]
[app.test-helpers :as th]
[app.tokens :as tokens]
[app.util.time :as dt]
[clojure.java.io :as io]
@ -110,7 +110,7 @@
:profile-id (:id profile)
:file {:filename "sample.jpg"
:size 123123
:path (th/tempfile "app/test_files/sample.jpg")
:path (th/tempfile "app_tests/test_files/sample.jpg")
:mtype "image/jpeg"}}
out (th/mutation! data)]

View file

@ -4,12 +4,12 @@
;;
;; Copyright (c) KALEIDOS INC
(ns app.services-projects-test
(ns app-tests.test-rpc-project
(:require
[app-tests.test-helpers :as th]
[app.common.uuid :as uuid]
[app.db :as db]
[app.http :as http]
[app.test-helpers :as th]
[app.util.time :as dt]
[clojure.test :as t]))

View file

@ -4,13 +4,13 @@
;;
;; Copyright (c) KALEIDOS INC
(ns app.services-teams-test
(ns app-tests.test-rpc-team
(:require
[app-tests.test-helpers :as th]
[app.common.uuid :as uuid]
[app.db :as db]
[app.http :as http]
[app.storage :as sto]
[app.test-helpers :as th]
[app.tokens :as tokens]
[app.util.time :as dt]
[clojure.test :as t]

View file

@ -4,11 +4,11 @@
;;
;; Copyright (c) KALEIDOS INC
(ns app.services-viewer-test
(ns app-tests.test-rpc-viewer
(:require
[app-tests.test-helpers :as th]
[app.common.uuid :as uuid]
[app.db :as db]
[app.test-helpers :as th]
[clojure.test :as t]
[datoteka.core :as fs]))

View file

@ -4,13 +4,13 @@
;;
;; Copyright (c) KALEIDOS INC
(ns app.storage-test
(ns app-tests.test-storage
(:require
[app-tests.test-helpers :as th]
[app.common.exceptions :as ex]
[app.common.uuid :as uuid]
[app.db :as db]
[app.storage :as sto]
[app.test-helpers :as th]
[app.util.time :as dt]
[clojure.test :as t]
[cuerdas.core :as str]
@ -126,7 +126,7 @@
:is-shared false})
mfile {:filename "sample.jpg"
:path (th/tempfile "app/test_files/sample.jpg")
:path (th/tempfile "app_tests/test_files/sample.jpg")
:mtype "image/jpeg"
:size 312043}
@ -196,12 +196,12 @@
:project-id proj-id
:is-shared false})
ttfdata (-> (io/resource "app/test_files/font-1.ttf")
ttfdata (-> (io/resource "app_tests/test_files/font-1.ttf")
io/input-stream
io/read-as-bytes)
mfile {:filename "sample.jpg"
:path (th/tempfile "app/test_files/sample.jpg")
:path (th/tempfile "app_tests/test_files/sample.jpg")
:mtype "image/jpeg"
:size 312043}
@ -267,7 +267,7 @@
:project-id (:default-project-id prof)
:is-shared false})
mfile {:filename "sample.jpg"
:path (th/tempfile "app/test_files/sample.jpg")
:path (th/tempfile "app_tests/test_files/sample.jpg")
:mtype "image/jpeg"
:size 312043}

View file

@ -4,11 +4,11 @@
;;
;; Copyright (c) KALEIDOS INC
(ns app.tasks-telemetry-test
(ns app-tests.test-telemetry-task
(:require
[app-tests.test-helpers :as th]
[app.db :as db]
[app.emails :as emails]
[app.test-helpers :as th]
[app.util.time :as dt]
[clojure.pprint :refer [pprint]]
[clojure.test :as t]