(TK-27) Add test for persistent async client
Add test for persistent async client. This test creates a persistent async client, then uses it to make each kind of HTTP request.
This commit is contained in:
parent
a2ef578c76
commit
54fa3d77fd
1 changed files with 41 additions and 1 deletions
|
@ -73,3 +73,43 @@
|
|||
|
||||
(deftest async-client-patch-test
|
||||
(basic-test "PATCH" #(AsyncHttpClient/patch %) async/patch))
|
||||
|
||||
(deftest persistent-async-client-test
|
||||
(testlogging/with-test-logging
|
||||
(testutils/with-app-with-config app
|
||||
[jetty9/jetty9-service test-web-service]
|
||||
{:webserver {:port 10000}}
|
||||
(let [client (async/create-client {})]
|
||||
(testing "HEAD request with persistent async client"
|
||||
(let [response (async/persist-head client "http://localhost:10000/hello/")]
|
||||
(is (= 200 (:status @response)))
|
||||
(is (= nil (:body @response)))))
|
||||
(testing "GET request with persistent async client"
|
||||
(let [response (async/persist-get client "http://localhost:10000/hello/")]
|
||||
(is (= 200 (:status @response)))
|
||||
(is (= "Hello, World!" (slurp (:body @response))))))
|
||||
(testing "POST request with persistent async client"
|
||||
(let [response (async/persist-post client "http://localhost:10000/hello/")]
|
||||
(is (= 200 (:status @response)))
|
||||
(is (= "Hello, World!" (slurp (:body @response))))))
|
||||
(testing "PUT request with persistent async client"
|
||||
(let [response (async/persist-put client "http://localhost:10000/hello/")]
|
||||
(is (= 200 (:status @response)))
|
||||
(is (= "Hello, World!" (slurp (:body @response))))))
|
||||
(testing "DELETE request with persistent async client"
|
||||
(let [response (async/persist-delete client "http://localhost:10000/hello/")]
|
||||
(is (= 200 (:status @response)))
|
||||
(is (= "Hello, World!" (slurp (:body @response))))))
|
||||
(testing "TRACE request with persistent async client"
|
||||
(let [response (async/persist-trace client "http://localhost:10000/hello/")]
|
||||
(is (= 200 (:status @response)))
|
||||
(is (= "Hello, World!" (slurp (:body @response))))))
|
||||
(testing "OPTIONS request with persistent async client"
|
||||
(let [response (async/persist-options client "http://localhost:10000/hello/")]
|
||||
(is (= 200 (:status @response)))
|
||||
(is (= "Hello, World!" (slurp (:body @response))))))
|
||||
(testing "PATCH request with persistent async client"
|
||||
(let [response (async/persist-patch client "http://localhost:10000/hello/")]
|
||||
(is (= 200 (:status @response)))
|
||||
(is (= "Hello, World!" (slurp (:body @response))))))
|
||||
(.close client)))))
|
Loading…
Reference in a new issue