forked from loafle/openapi-generator-original
Update Clojure Petstore with OpenAPI spec v3 (#181)
* update clojure test * update with clojure oas3
This commit is contained in:
parent
07dfbad29d
commit
6959ef9939
@ -1,5 +1,5 @@
|
||||
(defproject swagger-petstore "1.0.0"
|
||||
:description "This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters"
|
||||
:description "This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters"
|
||||
:license {:name "Apache-2.0"
|
||||
:url "http://www.apache.org/licenses/LICENSE-2.0.html"}
|
||||
:dependencies [[org.clojure/clojure "1.7.0"]
|
||||
|
@ -12,7 +12,7 @@
|
||||
:query-params {}
|
||||
:form-params {}
|
||||
:body-param pet
|
||||
:content-types ["application/json" "application/xml"]
|
||||
:content-types []
|
||||
:accepts []
|
||||
:auth-names ["petstore_auth"]})))
|
||||
|
||||
@ -50,7 +50,7 @@
|
||||
(call-api "/pet/findByStatus" :get
|
||||
{:path-params {}
|
||||
:header-params {}
|
||||
:query-params {"status" status }
|
||||
:query-params {"status" (with-collection-format status :multi) }
|
||||
:form-params {}
|
||||
:content-types []
|
||||
:accepts ["application/json" "application/xml"]
|
||||
@ -71,7 +71,7 @@
|
||||
(call-api "/pet/findByTags" :get
|
||||
{:path-params {}
|
||||
:header-params {}
|
||||
:query-params {"tags" tags }
|
||||
:query-params {"tags" (with-collection-format tags :multi) }
|
||||
:form-params {}
|
||||
:content-types []
|
||||
:accepts ["application/json" "application/xml"]
|
||||
@ -114,7 +114,7 @@
|
||||
:query-params {}
|
||||
:form-params {}
|
||||
:body-param pet
|
||||
:content-types ["application/json" "application/xml"]
|
||||
:content-types []
|
||||
:accepts []
|
||||
:auth-names ["petstore_auth"]})))
|
||||
|
||||
|
@ -71,7 +71,7 @@
|
||||
:query-params {}
|
||||
:form-params {}
|
||||
:body-param order
|
||||
:content-types []
|
||||
:content-types ["application/json"]
|
||||
:accepts ["application/json" "application/xml"]
|
||||
:auth-names []})))
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
:query-params {}
|
||||
:form-params {}
|
||||
:body-param user
|
||||
:content-types []
|
||||
:content-types ["application/json"]
|
||||
:accepts []
|
||||
:auth-names []})))
|
||||
|
||||
@ -150,7 +150,7 @@
|
||||
:query-params {}
|
||||
:form-params {}
|
||||
:body-param user
|
||||
:content-types []
|
||||
:content-types ["application/json"]
|
||||
:accepts []
|
||||
:auth-names []})))
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
(deftest test-create-and-get-pet
|
||||
(let [{:keys [id] :as pet} (make-random-pet)
|
||||
_ (add-pet {:body pet})
|
||||
_ (add-pet {:pet pet})
|
||||
fetched (get-pet-by-id id)]
|
||||
(is (identity fetched))
|
||||
(is (= id (:id fetched)))
|
||||
@ -32,7 +32,7 @@
|
||||
|
||||
(deftest test-create-and-get-pet-with-http-info
|
||||
(let [{:keys [id] :as pet} (make-random-pet)
|
||||
_ (add-pet-with-http-info {:body pet})
|
||||
_ (add-pet-with-http-info {:pet pet})
|
||||
{:keys [status headers data]} (get-pet-by-id-with-http-info id)]
|
||||
(is (= 200 status))
|
||||
(is (= "application/json" (:content-type headers)))
|
||||
@ -45,7 +45,7 @@
|
||||
(deftest test-find-pets-by-status
|
||||
(let [status "pending"
|
||||
{:keys [id] :as pet} (make-random-pet {:status status})
|
||||
_ (add-pet {:body pet})
|
||||
_ (add-pet {:pet pet})
|
||||
pets (find-pets-by-status {:status [status]})]
|
||||
(is (seq pets))
|
||||
(is (some #{id} (map :id pets)))
|
||||
@ -55,7 +55,7 @@
|
||||
(let [tag-name (str "tag-" (rand-int 1000))
|
||||
tag {:name tag-name}
|
||||
{:keys [id] :as pet} (make-random-pet {:tags [tag]})
|
||||
_ (add-pet {:body pet})
|
||||
_ (add-pet {:pet pet})
|
||||
pets (find-pets-by-tags {:tags [tag-name]})]
|
||||
(is (seq pets))
|
||||
(is (some #{id} (map :id pets)))
|
||||
@ -63,7 +63,7 @@
|
||||
|
||||
(deftest test-update-pet-with-form
|
||||
(let [{pet-id :id :as pet} (make-random-pet {:name "new name" :status "available"})
|
||||
_ (add-pet {:body pet})
|
||||
_ (add-pet {:pet pet})
|
||||
{:keys [id name status]} (get-pet-by-id pet-id)]
|
||||
(is (= pet-id id))
|
||||
(is (= "new name" name))
|
||||
@ -90,7 +90,7 @@
|
||||
|
||||
(deftest test-delete-pet
|
||||
(let [{:keys [id] :as pet} (make-random-pet)
|
||||
_ (add-pet {:body pet})
|
||||
_ (add-pet {:pet pet})
|
||||
fetched (get-pet-by-id id)]
|
||||
(is (= id (:id fetched)))
|
||||
(delete-pet id)
|
||||
@ -98,7 +98,7 @@
|
||||
|
||||
(deftest test-upload-file
|
||||
(let [{:keys [id] :as pet} (make-random-pet)
|
||||
_ (add-pet {:body pet})
|
||||
_ (add-pet {:pet pet})
|
||||
file (io/file (io/resource "hello.txt"))]
|
||||
;; no errors with upload-file
|
||||
(upload-file id {:file file :additional-metadata "uploading file with clojure client"})))
|
||||
|
@ -25,7 +25,7 @@
|
||||
(deftest test-place-and-delete-order
|
||||
(let [order (make-random-order)
|
||||
order-id (:id order)
|
||||
_ (place-order {:body order})
|
||||
_ (place-order {:order order})
|
||||
fetched (get-order-by-id order-id)]
|
||||
(doseq [attr [:id :petId :quantity]]
|
||||
(is (= (attr order) (attr fetched))))
|
||||
|
@ -21,7 +21,7 @@
|
||||
(deftest test-create-and-delete-user
|
||||
(let [user (make-random-user)
|
||||
username (:username user)
|
||||
_ (create-user {:body user})
|
||||
_ (create-user {:user user})
|
||||
fetched (get-user-by-name username)]
|
||||
(doseq [attr [:id :username :password :userStatus]]
|
||||
(is (= (attr user) (attr fetched))))
|
||||
@ -33,7 +33,7 @@
|
||||
id2 (inc id1)
|
||||
user1 (make-random-user {:id id1})
|
||||
user2 (make-random-user {:id id2})]
|
||||
(create-users-with-array-input {:body [user1 user2]})
|
||||
(create-users-with-array-input {:user [user1 user2]})
|
||||
(let [fetched (get-user-by-name (:username user1))]
|
||||
(is (= id1 (:id fetched))))
|
||||
(let [fetched (get-user-by-name (:username user2))]
|
||||
@ -46,7 +46,7 @@
|
||||
id2 (inc id1)
|
||||
user1 (make-random-user {:id id1})
|
||||
user2 (make-random-user {:id id2})]
|
||||
(create-users-with-list-input {:body [user1 user2]})
|
||||
(create-users-with-list-input {:user [user1 user2]})
|
||||
(let [fetched (get-user-by-name (:username user1))]
|
||||
(is (= id1 (:id fetched))))
|
||||
(let [fetched (get-user-by-name (:username user2))]
|
||||
@ -56,7 +56,7 @@
|
||||
|
||||
(deftest test-login-and-lougout-user
|
||||
(let [{:keys [username password] :as user} (make-random-user)
|
||||
_ (create-user {:body user})
|
||||
_ (create-user {:user user})
|
||||
result (login-user {:username username :password password})]
|
||||
(is (re-matches #"logged in user session:.+" result))
|
||||
;; no error with logout-user
|
||||
|
Loading…
x
Reference in New Issue
Block a user