🐛 Fix import-binfile schema test (#11118)

This commit is contained in:
Elena Torró 2026-08-06 17:05:41 +02:00 committed by GitHub
parent 229d24e8f2
commit 688c69b478
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -17,26 +17,18 @@
(t/use-fixtures :once th/state-init)
(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
;; The schema should not accept file-id as a valid parameter
(let [schema @#'binfile/schema:import-binfile
validator (sm/lazy-validator schema)
;; Valid params without file-id
valid-params {:name "test"
:project-id (uuid/random)
: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))
"params without file-id should be valid")
;; Params with file-id should fail validation after fix
;; (Currently this will fail because file-id is still in schema)
(t/is (false? (validator params-with-file-id))
"params with file-id should be rejected")))
(t/is (not (contains? (sm/keys (second schema)) :file-id))
"file-id should not be a declared parameter")))