diff -Nru ring-mock-clojure-0.3.1/debian/changelog ring-mock-clojure-0.3.2/debian/changelog --- ring-mock-clojure-0.3.1/debian/changelog 2017-08-05 11:53:48.000000000 +0000 +++ ring-mock-clojure-0.3.2/debian/changelog 2020-11-06 12:31:59.000000000 +0000 @@ -1,3 +1,25 @@ +ring-mock-clojure (0.3.2-2) unstable; urgency=medium + + * Rebuilt source-only. + + -- Thomas Goirand Fri, 06 Nov 2020 13:31:59 +0100 + +ring-mock-clojure (0.3.2-1) unstable; urgency=medium + + * Team upload. + * debian/rules: added code to manage upstream tags. + * New upstream release. + * Ran wrap-and-sort -bastk. + * Use debhelper-compat. + * Removed versions in build-depends when satisfied in Stable. + * Move the package to the Clojure team: + - Change Maintainer field. + - Change VCS URLs. + * Standards-Version: 4.5.0. + * Add libcheshire-clojure as build-depends and fix CLASSPATH. + + -- Thomas Goirand Fri, 06 Nov 2020 13:21:43 +0100 + ring-mock-clojure (0.3.1-1) unstable; urgency=medium * Initial release (Closes: #855750) diff -Nru ring-mock-clojure-0.3.1/debian/compat ring-mock-clojure-0.3.2/debian/compat --- ring-mock-clojure-0.3.1/debian/compat 2017-08-05 11:53:14.000000000 +0000 +++ ring-mock-clojure-0.3.2/debian/compat 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -10 diff -Nru ring-mock-clojure-0.3.1/debian/control ring-mock-clojure-0.3.2/debian/control --- ring-mock-clojure-0.3.1/debian/control 2017-08-05 11:53:48.000000000 +0000 +++ ring-mock-clojure-0.3.2/debian/control 2020-11-06 12:31:59.000000000 +0000 @@ -1,27 +1,30 @@ Source: ring-mock-clojure Section: java Priority: optional -Maintainer: Debian Java Maintainers -Uploaders: Apollon Oikonomopoulos +Maintainer: Debian Clojure Maintainers +Uploaders: + Apollon Oikonomopoulos , Build-Depends: - debhelper (>= 10), - javahelper (>= 0.32), - maven-repo-helper (>= 1.7), - clojure (>= 1.8), - libring-codec-clojure (>= 1.0.0), + clojure, + debhelper-compat (= 10), + default-jdk-headless, + javahelper, + libcheshire-clojure, + libring-codec-clojure, libtext-markdown-perl | markdown, - default-jdk-headless -Standards-Version: 4.0.0 -Vcs-Git: https://anonscm.debian.org/git/pkg-java/ring-mock-clojure.git -Vcs-Browser: https://anonscm.debian.org/cgit/pkg-java/ring-mock-clojure.git + maven-repo-helper, +Standards-Version: 4.5.0 +Vcs-Git: https://salsa.debian.org/clojure-team/ring-mock-clojure.git +Vcs-Browser: https://salsa.debian.org/clojure-team/ring-mock-clojure Homepage: https://github.com/ring-clojure/ring-mock Package: libring-mock-clojure Architecture: all Depends: ${java:Depends}, - ${misc:Depends} -Recommends: ${java:Recommends} + ${misc:Depends}, +Recommends: + ${java:Recommends}, Description: library for creating mock Ring request maps Ring-mock is a library for creating mock Ring request maps. It is primarily used for testing applications using Ring. diff -Nru ring-mock-clojure-0.3.1/debian/rules ring-mock-clojure-0.3.2/debian/rules --- ring-mock-clojure-0.3.1/debian/rules 2017-08-05 11:53:48.000000000 +0000 +++ ring-mock-clojure-0.3.2/debian/rules 2020-11-06 12:31:59.000000000 +0000 @@ -2,10 +2,17 @@ include /usr/share/javahelper/java-vars.mk +DEB_PKGNAME := $(shell dpkg-parsechangelog -SSource) +DEB_VERSION := $(shell dpkg-parsechangelog -SVersion) +DEB_NOEPOCH_VERSION := $(shell echo $(DEB_VERSION) | cut -d: -f2-) +DEB_UPSTREAM_VERSION := $(shell echo $(DEB_NOEPOCH_VERSION) | sed 's/-[^-]*$$//') +GIT_TAG := $(shell echo '$(DEB_UPSTREAM_VERSION)' | sed -e 's/~/_/') +UPSTREAM_GIT = https://github.com/ring-clojure/ring-mock + MDWN_DOCS = $(patsubst %.md,%.html,$(wildcard $(CURDIR)/*.md)) PRODUCED_JAR=ring-mock.jar -export CLASSPATH=/usr/share/java/clojure.jar:/usr/share/java/ring-codec.jar +export CLASSPATH=/usr/share/java/clojure.jar:/usr/share/java/ring-codec.jar:/usr/share/java/cheshire.jar %: dh $@ --with javahelper --with jh_maven_repo_helper @@ -32,3 +39,19 @@ dh_auto_test (cd test && find . -name "*.clj" | \ xargs clojure -cp $(CURDIR)/$(PRODUCED_JAR):$(CLASSPATH)) + +gen-orig-xz: + git tag -v $(GIT_TAG) || true + if [ ! -f ../$(DEBPKGNAME)_$(VERSION).orig.tar.xz ] ; then \ + git archive --prefix=$(DEB_PKGNAME)-$(DEB_UPSTREAM_VERSION)/ $(GIT_TAG) | xz >../$(DEB_PKGNAME)_$(DEB_UPSTREAM_VERSION).orig.tar.xz ; \ + mkdir -p ../build-area ; \ + cp ../$(DEB_PKGNAME)_$(DEB_UPSTREAM_VERSION).orig.tar.xz ../build-area ; \ + fi + +fetch-upstream-remote: +ifeq (,$(findstring https:,$(UPSTREAM_GIT))) + $(error Using insecure proto in UPSTREAM_GIT: $(UPSTREAM_GIT)) +endif + git remote add upstream $(UPSTREAM_GIT) || true + git remote set-url upstream $(UPSTREAM_GIT) + git fetch upstream diff -Nru ring-mock-clojure-0.3.1/.gitignore ring-mock-clojure-0.3.2/.gitignore --- ring-mock-clojure-0.3.1/.gitignore 2017-06-30 17:12:43.000000000 +0000 +++ ring-mock-clojure-0.3.2/.gitignore 2017-11-15 23:51:13.000000000 +0000 @@ -2,7 +2,7 @@ /lib /classes /checkouts -/doc +/codox pom.xml pom.xml.asc *.jar diff -Nru ring-mock-clojure-0.3.1/project.clj ring-mock-clojure-0.3.2/project.clj --- ring-mock-clojure-0.3.1/project.clj 2017-06-30 17:12:43.000000000 +0000 +++ ring-mock-clojure-0.3.2/project.clj 2017-11-15 23:51:13.000000000 +0000 @@ -1,16 +1,20 @@ -(defproject ring/ring-mock "0.3.1" +(defproject ring/ring-mock "0.3.2" :description "A library for creating mock Ring request maps" :url "https://github.com/ring-clojure/ring-mock" :license {:name "The MIT License" :url "http://opensource.org/licenses/MIT"} :dependencies [[org.clojure/clojure "1.5.1"] + [cheshire "5.8.0"] [ring/ring-codec "1.0.1"]] - :plugins [[codox "0.10.3"]] - :codox {:project {:name "Ring-Mock"}} + :plugins [[lein-codox "0.10.3"]] + :codox + {:project {:name "Ring-Mock"} + :output-path "codox" + :source-uri "https://github.com/ring-clojure/ring/blob/{version}/{filepath}#L{line}"} :aliases {"test-all" ["with-profile" "default:+1.6:+1.7:+1.8:+1.9" "test"]} :profiles {:1.6 {:dependencies [[org.clojure/clojure "1.6.0"]]} :1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]} :1.8 {:dependencies [[org.clojure/clojure "1.8.0"]]} - :1.9 {:dependencies [[org.clojure/clojure "1.9.0-alpha17"] + :1.9 {:dependencies [[org.clojure/clojure "1.9.0-RC1"] [ring/ring-spec "0.0.3"]]}}) diff -Nru ring-mock-clojure-0.3.1/README.md ring-mock-clojure-0.3.2/README.md --- ring-mock-clojure-0.3.1/README.md 2017-06-30 17:12:43.000000000 +0000 +++ ring-mock-clojure-0.3.2/README.md 2017-11-15 23:51:13.000000000 +0000 @@ -11,7 +11,7 @@ Add the following development dependency to your `project.clj` file: - [ring/ring-mock "0.3.1"] + [ring/ring-mock "0.3.2"] ## Documentation @@ -30,6 +30,13 @@ {:status 200 :headers {"content-type" "text/plain"} :body "Your expected result"}))) + +(deftest your-json-handler-test + (is (= (your-handler (-> (mock/request :post "/api/endpoint") + (json-body {:foo "bar"}))) + {:status 201 + :headers {"content-type" "application/json"} + :body {:key "your expected result"}}))) ``` ## License diff -Nru ring-mock-clojure-0.3.1/src/ring/mock/request.clj ring-mock-clojure-0.3.2/src/ring/mock/request.clj --- ring-mock-clojure-0.3.1/src/ring/mock/request.clj 2017-06-30 17:12:43.000000000 +0000 +++ ring-mock-clojure-0.3.2/src/ring/mock/request.clj 2017-11-15 23:51:13.000000000 +0000 @@ -1,6 +1,7 @@ (ns ring.mock.request "Functions to create mock request maps." - (:require [clojure.string :as string] + (:require [cheshire.core :as json] + [clojure.string :as string] [ring.util.codec :as codec])) (defn- encode-params @@ -75,6 +76,14 @@ (defmethod body nil [request params] request) +(defn json-body + "Set the body of the request to a JSON structure. The supplied body value + should be a map of parameters to be converted to JSON." + [request body-value] + (-> request + (content-type "application/json") + (body (json/generate-string body-value)))) + (def default-port "A map of the default ports for a scheme." {:http 80 diff -Nru ring-mock-clojure-0.3.1/test/ring/mock/request_test.clj ring-mock-clojure-0.3.2/test/ring/mock/request_test.clj --- ring-mock-clojure-0.3.1/test/ring/mock/request_test.clj 2017-06-30 17:12:43.000000000 +0000 +++ ring-mock-clojure-0.3.2/test/ring/mock/request_test.clj 2017-11-15 23:51:13.000000000 +0000 @@ -136,6 +136,15 @@ (is (= (slurp (:body resp)) "foo")) (is (= (:content-length resp) 3))))) +(deftest test-json-body + (testing "json body" + (let [resp (json-body {} {:baz ["qu" "qi" "qo"]})] + (is (= (:content-type resp) "application/json")) + (is (instance? java.io.InputStream (:body resp))) + (is (= (slurp (:body resp)) + "{\"baz\":[\"qu\",\"qi\",\"qo\"]}")) + (is (= (:content-length resp) 24))))) + (defmacro when-clojure-spec [& body] (when (try