mirror of
https://github.com/penpot/penpot.git
synced 2026-08-18 18:58:40 +00:00
🐛 Fix import-binfile schema test (#11118)
This commit is contained in:
parent
229d24e8f2
commit
688c69b478
@ -17,26 +17,18 @@
|
|||||||
(t/use-fixtures :once th/state-init)
|
(t/use-fixtures :once th/state-init)
|
||||||
(t/use-fixtures :each th/database-reset)
|
(t/use-fixtures :each th/database-reset)
|
||||||
|
|
||||||
(t/deftest import-binfile-schema-rejects-file-id
|
(t/deftest import-binfile-schema-omits-file-id
|
||||||
;; N1-06: file-id parameter must be removed from schema for security
|
;; N1-06: file-id parameter must be removed from schema for security
|
||||||
;; The schema should not accept file-id as a valid parameter
|
|
||||||
(let [schema @#'binfile/schema:import-binfile
|
(let [schema @#'binfile/schema:import-binfile
|
||||||
validator (sm/lazy-validator schema)
|
validator (sm/lazy-validator schema)
|
||||||
|
|
||||||
;; Valid params without file-id
|
|
||||||
valid-params {:name "test"
|
valid-params {:name "test"
|
||||||
:project-id (uuid/random)
|
:project-id (uuid/random)
|
||||||
:version 3
|
:version 3
|
||||||
:upload-id (uuid/random)}
|
:upload-id (uuid/random)}]
|
||||||
|
|
||||||
;; Params with file-id (should be rejected after fix)
|
|
||||||
params-with-file-id (assoc valid-params :file-id (uuid/random))]
|
|
||||||
|
|
||||||
;; Valid params without file-id should pass
|
|
||||||
(t/is (true? (validator valid-params))
|
(t/is (true? (validator valid-params))
|
||||||
"params without file-id should be valid")
|
"params without file-id should be valid")
|
||||||
|
|
||||||
;; Params with file-id should fail validation after fix
|
(t/is (not (contains? (sm/keys (second schema)) :file-id))
|
||||||
;; (Currently this will fail because file-id is still in schema)
|
"file-id should not be a declared parameter")))
|
||||||
(t/is (false? (validator params-with-file-id))
|
|
||||||
"params with file-id should be rejected")))
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user