mirror of
https://github.com/metosin/reitit.git
synced 2025-12-17 16:31:11 +00:00
test: simplify openapi_test.clj a bit more
This commit is contained in:
parent
bcd12d9f31
commit
d0ff64df57
1 changed files with 37 additions and 37 deletions
|
|
@ -408,23 +408,23 @@
|
|||
(get-in [:paths "/parameters" :post :parameters])
|
||||
normalize))))
|
||||
(testing "body parameter"
|
||||
(is (match? {:schema (merge {:type "object"
|
||||
:properties {:b {:type "string"}}
|
||||
:required ["b"]}
|
||||
;; spec outputs open schemas
|
||||
(when-not (#{#'spec/coercion} coercion)
|
||||
{:additionalProperties false}))}
|
||||
(is (match? (merge {:type "object"
|
||||
:properties {:b {:type "string"}}
|
||||
:required ["b"]}
|
||||
;; spec outputs open schemas
|
||||
(when-not (#{#'spec/coercion} coercion)
|
||||
{:additionalProperties false}))
|
||||
(-> spec
|
||||
(get-in [:paths "/parameters" :post :requestBody :content "application/json"])
|
||||
(get-in [:paths "/parameters" :post :requestBody :content "application/json" :schema])
|
||||
normalize))))
|
||||
(testing "body response"
|
||||
(is (match? {:schema (merge {:type "object"
|
||||
:properties {:ok {:type "string"}}
|
||||
:required ["ok"]}
|
||||
(when-not (#{#'spec/coercion} coercion)
|
||||
{:additionalProperties false}))}
|
||||
(is (match? (merge {:type "object"
|
||||
:properties {:ok {:type "string"}}
|
||||
:required ["ok"]}
|
||||
(when-not (#{#'spec/coercion} coercion)
|
||||
{:additionalProperties false}))
|
||||
(-> spec
|
||||
(get-in [:paths "/parameters" :post :responses 200 :content "application/json"])
|
||||
(get-in [:paths "/parameters" :post :responses 200 :content "application/json" :schema])
|
||||
normalize))))
|
||||
(testing "spec is valid"
|
||||
(is (nil? (validate spec))))))))
|
||||
|
|
@ -461,38 +461,38 @@
|
|||
app
|
||||
:body)]
|
||||
(testing "body parameter"
|
||||
(is (match? {:schema (merge {:type "object"
|
||||
:properties {:b {:type "string"}}
|
||||
:required ["b"]}
|
||||
(when-not (#{#'spec/coercion} coercion)
|
||||
{:additionalProperties false}))}
|
||||
(is (match? (merge {:type "object"
|
||||
:properties {:b {:type "string"}}
|
||||
:required ["b"]}
|
||||
(when-not (#{#'spec/coercion} coercion)
|
||||
{:additionalProperties false}))
|
||||
(-> spec
|
||||
(get-in [:paths "/parameters" :post :requestBody :content "application/json"])
|
||||
(get-in [:paths "/parameters" :post :requestBody :content "application/json" :schema])
|
||||
normalize)))
|
||||
(is (match? {:schema (merge {:type "object"
|
||||
:properties {:c {:type "string"}}
|
||||
:required ["c"]}
|
||||
(when-not (#{#'spec/coercion} coercion)
|
||||
{:additionalProperties false}))}
|
||||
(is (match? (merge {:type "object"
|
||||
:properties {:c {:type "string"}}
|
||||
:required ["c"]}
|
||||
(when-not (#{#'spec/coercion} coercion)
|
||||
{:additionalProperties false}))
|
||||
(-> spec
|
||||
(get-in [:paths "/parameters" :post :requestBody :content "application/edn"])
|
||||
(get-in [:paths "/parameters" :post :requestBody :content "application/edn" :schema])
|
||||
normalize))))
|
||||
(testing "body response"
|
||||
(is (match? {:schema (merge {:type "object"
|
||||
:properties {:ok {:type "string"}}
|
||||
:required ["ok"]}
|
||||
(when-not (#{#'spec/coercion} coercion)
|
||||
{:additionalProperties false}))}
|
||||
(is (match? (merge {:type "object"
|
||||
:properties {:ok {:type "string"}}
|
||||
:required ["ok"]}
|
||||
(when-not (#{#'spec/coercion} coercion)
|
||||
{:additionalProperties false}))
|
||||
(-> spec
|
||||
(get-in [:paths "/parameters" :post :responses 200 :content "application/json"])
|
||||
(get-in [:paths "/parameters" :post :responses 200 :content "application/json" :schema])
|
||||
normalize)))
|
||||
(is (match? {:schema (merge {:type "object"
|
||||
:properties {:edn {:type "string"}}
|
||||
:required ["edn"]}
|
||||
(when-not (#{#'spec/coercion} coercion)
|
||||
{:additionalProperties false}))}
|
||||
(is (match? (merge {:type "object"
|
||||
:properties {:edn {:type "string"}}
|
||||
:required ["edn"]}
|
||||
(when-not (#{#'spec/coercion} coercion)
|
||||
{:additionalProperties false}))
|
||||
(-> spec
|
||||
(get-in [:paths "/parameters" :post :responses 200 :content "application/edn"])
|
||||
(get-in [:paths "/parameters" :post :responses 200 :content "application/edn" :schema])
|
||||
normalize))))
|
||||
(testing "validation"
|
||||
(let [query {:request-method :post
|
||||
|
|
|
|||
Loading…
Reference in a new issue