Much work on error reporting architecture for validation
This commit is contained in:
parent
5593bb22d1
commit
25795cf364
43 changed files with 2024 additions and 1067 deletions
|
|
@ -8,442 +8,451 @@
|
|||
001 (ns clj-activitypub.core
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
002 (:require [clj-activitypub.internal.crypto :as crypto]
|
||||
002 "copied from [Jahfer's clj-activitypub library](https://github.com/jahfer/clj-activitypub).
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
003 [clj-activitypub.internal.thread-cache :as thread-cache]
|
||||
003 If and when Jahfer issues a release of that library, this directory will be deleted and a
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
004 [clj-activitypub.internal.http-util :as http]
|
||||
004 dependency on that library will be added to the project."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
005 [clj-http.client :as client]
|
||||
005 (:require [clj-activitypub.internal.crypto :as crypto]
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
006 [clojure.string :as str]))
|
||||
006 [clj-activitypub.internal.thread-cache :as thread-cache]
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
007 [clj-activitypub.internal.http-util :as http]
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
008 [clj-http.client :as client]
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
009 [clojure.string :as str]))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
007
|
||||
010
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
008 (defn config
|
||||
011 (defn config
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
009 "Creates hash of computed data relevant for most ActivityPub utilities."
|
||||
012 "Creates hash of computed data relevant for most ActivityPub utilities."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
010 [{:keys [domain username username-route public-key private-key]
|
||||
013 [{:keys [domain username username-route public-key private-key]
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
011 :or {username-route "/users/"
|
||||
014 :or {username-route "/users/"
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
012 public-key nil
|
||||
015 public-key nil
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
013 private-key nil}}]
|
||||
016 private-key nil}}]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 5 forms covered">
|
||||
014 (let [base-url (str "https://" domain)]
|
||||
017 (let [base-url (str "https://" domain)]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 8 forms covered">
|
||||
015 {:domain domain
|
||||
018 {:domain domain
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
016 :base-url base-url
|
||||
019 :base-url base-url
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
017 :username username
|
||||
020 :username username
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 5 forms covered">
|
||||
018 :user-id (str base-url username-route username)
|
||||
021 :user-id (str base-url username-route username)
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
019 :public-key public-key
|
||||
022 :public-key public-key
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 3 forms covered">
|
||||
020 :private-key (when private-key
|
||||
023 :private-key (when private-key
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 3 forms covered">
|
||||
021 (crypto/private-key private-key))}))
|
||||
024 (crypto/private-key private-key))}))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
022
|
||||
025
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
023 (defn parse-account
|
||||
026 (defn parse-account
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
024 "Given an ActivityPub handle (e.g. @jahfer@mastodon.social), produces
|
||||
027 "Given an ActivityPub handle (e.g. @jahfer@mastodon.social), produces
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
025 a map containing {:domain ... :username ...}."
|
||||
028 a map containing {:domain ... :username ...}."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
026 [handle]
|
||||
029 [handle]
|
||||
</span><br/>
|
||||
<span class="covered" title="9 out of 9 forms covered">
|
||||
027 (let [[username domain] (filter #(not (str/blank? %))
|
||||
030 (let [[username domain] (filter #(not (str/blank? %))
|
||||
</span><br/>
|
||||
<span class="covered" title="4 out of 4 forms covered">
|
||||
028 (str/split handle #"@"))]
|
||||
031 (str/split handle #"@"))]
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
029 {:domain domain :username username}))
|
||||
032 {:domain domain :username username}))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
030
|
||||
033
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
031 (def ^:private user-cache (thread-cache/make))
|
||||
034 (def ^:private user-cache (thread-cache/make))
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
032 (defn fetch-user
|
||||
035 (defn fetch-user
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
033 "Fetches the customer account details located at user-id from a remote
|
||||
036 "Fetches the customer account details located at user-id from a remote
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
034 server. Will return cached results if they exist in memory."
|
||||
037 server. Will return cached results if they exist in memory."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
035 [user-id]
|
||||
038 [user-id]
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
036 ((:get-v user-cache)
|
||||
039 ((:get-v user-cache)
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
037 user-id
|
||||
040 user-id
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
038 #(:body
|
||||
041 #(:body
|
||||
</span><br/>
|
||||
<span class="covered" title="11 out of 11 forms covered">
|
||||
039 (client/get user-id {:as :json-string-keys
|
||||
042 (client/get user-id {:as :json-string-keys
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
040 :throw-exceptions false
|
||||
043 :throw-exceptions false
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
041 :ignore-unknown-host? true
|
||||
044 :ignore-unknown-host? true
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
042 :headers {"Accept" "application/activity+json"}}))))
|
||||
045 :headers {"Accept" "application/activity+json"}}))))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
043
|
||||
046
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
044 (defn actor
|
||||
047 (defn actor
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
045 "Accepts a config, and returns a map in the form expected by the ActivityPub
|
||||
048 "Accepts a config, and returns a map in the form expected by the ActivityPub
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
046 spec. See https://www.w3.org/TR/activitypub/#actor-objects for reference."
|
||||
049 spec. See https://www.w3.org/TR/activitypub/#actor-objects for reference."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
047 [{:keys [user-id username public-key]}]
|
||||
050 [{:keys [user-id username public-key]}]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 12 forms covered">
|
||||
048 {"@context" ["https://www.w3.org/ns/activitystreams"
|
||||
051 {"@context" ["https://www.w3.org/ns/activitystreams"
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
049 "https://w3id.org/security/v1"]
|
||||
052 "https://w3id.org/security/v1"]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
050 :id user-id
|
||||
053 :id user-id
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
051 :type "Person"
|
||||
054 :type "Person"
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
052 :preferredUsername username
|
||||
055 :preferredUsername username
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 4 forms covered">
|
||||
053 :inbox (str user-id "/inbox")
|
||||
056 :inbox (str user-id "/inbox")
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 4 forms covered">
|
||||
054 :outbox (str user-id "/outbox")
|
||||
057 :outbox (str user-id "/outbox")
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 8 forms covered">
|
||||
055 :publicKey {:id (str user-id "#main-key")
|
||||
058 :publicKey {:id (str user-id "#main-key")
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
056 :owner user-id
|
||||
059 :owner user-id
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 6 forms covered">
|
||||
057 :publicKeyPem (or public-key "")}})
|
||||
060 :publicKeyPem (or public-key "")}})
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
058
|
||||
061
|
||||
</span><br/>
|
||||
<span class="covered" title="6 out of 6 forms covered">
|
||||
059 (def signature-headers ["(request-target)" "host" "date" "digest"])
|
||||
062 (def signature-headers ["(request-target)" "host" "date" "digest"])
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
060
|
||||
063
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
061 (defn- str-for-signature [headers]
|
||||
064 (defn- str-for-signature [headers]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 3 forms covered">
|
||||
062 (let [headers-xf (reduce-kv
|
||||
065 (let [headers-xf (reduce-kv
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
063 (fn [m k v]
|
||||
066 (fn [m k v]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 9 forms covered">
|
||||
064 (assoc m (str/lower-case k) v)) {} headers)]
|
||||
067 (assoc m (str/lower-case k) v)) {} headers)]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 2 forms covered">
|
||||
065 (->> signature-headers
|
||||
068 (->> signature-headers
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 3 forms covered">
|
||||
066 (select-keys headers-xf)
|
||||
069 (select-keys headers-xf)
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 12 forms covered">
|
||||
067 (reduce-kv (fn [coll k v] (conj coll (str k ": " v))) [])
|
||||
070 (reduce-kv (fn [coll k v] (conj coll (str k ": " v))) [])
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 3 forms covered">
|
||||
068 (interpose "\n")
|
||||
071 (interpose "\n")
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 2 forms covered">
|
||||
069 (apply str))))
|
||||
072 (apply str))))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
070
|
||||
073
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
071 (defn gen-signature-header
|
||||
074 (defn gen-signature-header
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
072 "Generates a HTTP Signature string based on the provided map of headers."
|
||||
075 "Generates a HTTP Signature string based on the provided map of headers."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
073 [config headers]
|
||||
076 [config headers]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 2 forms covered">
|
||||
074 (let [{:keys [user-id private-key]} config
|
||||
077 (let [{:keys [user-id private-key]} config
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 3 forms covered">
|
||||
075 string-to-sign (str-for-signature headers)
|
||||
078 string-to-sign (str-for-signature headers)
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 6 forms covered">
|
||||
076 signature (crypto/base64-encode (crypto/sign string-to-sign private-key))
|
||||
079 signature (crypto/base64-encode (crypto/sign string-to-sign private-key))
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 5 forms covered">
|
||||
077 sig-header-keys {"keyId" user-id
|
||||
080 sig-header-keys {"keyId" user-id
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 4 forms covered">
|
||||
078 "headers" (str/join " " signature-headers)
|
||||
081 "headers" (str/join " " signature-headers)
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
079 "signature" signature}]
|
||||
082 "signature" signature}]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 2 forms covered">
|
||||
080 (->> sig-header-keys
|
||||
083 (->> sig-header-keys
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 3 forms covered">
|
||||
081 (reduce-kv (fn [m k v]
|
||||
084 (reduce-kv (fn [m k v]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 11 forms covered">
|
||||
082 (conj m (str k "=" "\"" v "\""))) [])
|
||||
085 (conj m (str k "=" "\"" v "\""))) [])
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 3 forms covered">
|
||||
083 (interpose ",")
|
||||
086 (interpose ",")
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 2 forms covered">
|
||||
084 (apply str))))
|
||||
087 (apply str))))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
085
|
||||
088
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
086 (defn auth-headers
|
||||
089 (defn auth-headers
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
087 "Given a config and request map of {:body ... :headers ...}, returns the
|
||||
090 "Given a config and request map of {:body ... :headers ...}, returns the
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
088 original set of headers with Signature and Digest attributes appended."
|
||||
091 original set of headers with Signature and Digest attributes appended."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
089 [config {:keys [body headers]}]
|
||||
092 [config {:keys [body headers]}]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 4 forms covered">
|
||||
090 (let [digest (http/digest body)
|
||||
093 (let [digest (http/digest body)
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 4 forms covered">
|
||||
091 h (-> headers
|
||||
094 h (-> headers
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 4 forms covered">
|
||||
092 (assoc "Digest" digest)
|
||||
095 (assoc "Digest" digest)
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
093 (assoc "(request-target)" "post /inbox"))]
|
||||
096 (assoc "(request-target)" "post /inbox"))]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 5 forms covered">
|
||||
094 (assoc headers
|
||||
097 (assoc headers
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 4 forms covered">
|
||||
095 "Signature" (gen-signature-header config h)
|
||||
098 "Signature" (gen-signature-header config h)
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
096 "Digest" digest)))
|
||||
099 "Digest" digest)))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
097
|
||||
100
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
098 (defmulti obj
|
||||
101 (defmulti obj
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
099 "Produces a map representing an ActivityPub object which can be serialized
|
||||
102 "Produces a map representing an ActivityPub object which can be serialized
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
100 directly to JSON in the form expected by the ActivityStreams 2.0 spec.
|
||||
103 directly to JSON in the form expected by the ActivityStreams 2.0 spec.
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
101 See https://www.w3.org/TR/activitystreams-vocabulary/ for reference."
|
||||
104 See https://www.w3.org/TR/activitystreams-vocabulary/ for reference."
|
||||
</span><br/>
|
||||
<span class="partial" title="1 out of 4 forms covered">
|
||||
102 (fn [_config object-data] (:type object-data)))
|
||||
105 (fn [_config object-data] (:type object-data)))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
103
|
||||
106
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
104 (defmethod obj :note
|
||||
107 (defmethod obj :note
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
105 [{:keys [user-id]}
|
||||
108 [{:keys [user-id]}
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
106 {:keys [id published inReplyTo content to]
|
||||
109 {:keys [id published inReplyTo content to]
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
107 :or {published (http/date)
|
||||
110 :or {published (http/date)
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
108 inReplyTo ""
|
||||
111 inReplyTo ""
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
109 to "https://www.w3.org/ns/activitystreams#Public"}}]
|
||||
112 to "https://www.w3.org/ns/activitystreams#Public"}}]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 14 forms covered">
|
||||
110 {"id" (str user-id "/notes/" id)
|
||||
113 {"id" (str user-id "/notes/" id)
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
111 "type" "Note"
|
||||
114 "type" "Note"
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
112 "published" published
|
||||
115 "published" published
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
113 "attributedTo" user-id
|
||||
116 "attributedTo" user-id
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
114 "inReplyTo" inReplyTo
|
||||
117 "inReplyTo" inReplyTo
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
115 "content" content
|
||||
118 "content" content
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
116 "to" to})
|
||||
119 "to" to})
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
117
|
||||
120
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
118 (defmulti activity
|
||||
121 (defmulti activity
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
119 "Produces a map representing an ActivityPub activity which can be serialized
|
||||
122 "Produces a map representing an ActivityPub activity which can be serialized
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
120 directly to JSON in the form expected by the ActivityStreams 2.0 spec.
|
||||
123 directly to JSON in the form expected by the ActivityStreams 2.0 spec.
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
121 See https://www.w3.org/TR/activitystreams-vocabulary/ for reference."
|
||||
124 See https://www.w3.org/TR/activitystreams-vocabulary/ for reference."
|
||||
</span><br/>
|
||||
<span class="partial" title="1 out of 2 forms covered">
|
||||
122 (fn [_config activity-type _data] activity-type))
|
||||
125 (fn [_config activity-type _data] activity-type))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
123
|
||||
126
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
124 (defmethod activity :create [{:keys [user-id]} _ data]
|
||||
127 (defmethod activity :create [{:keys [user-id]} _ data]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 9 forms covered">
|
||||
125 {"@context" ["https://www.w3.org/ns/activitystreams"
|
||||
128 {"@context" ["https://www.w3.org/ns/activitystreams"
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
126 "https://w3id.org/security/v1"]
|
||||
129 "https://w3id.org/security/v1"]
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
127 "type" "Create"
|
||||
130 "type" "Create"
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
128 "actor" user-id
|
||||
131 "actor" user-id
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
129 "object" data})
|
||||
132 "object" data})
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
130
|
||||
133
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
131 (defmethod activity :delete [{:keys [user-id]} _ data]
|
||||
134 (defmethod activity :delete [{:keys [user-id]} _ data]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 9 forms covered">
|
||||
132 {"@context" ["https://www.w3.org/ns/activitystreams"
|
||||
135 {"@context" ["https://www.w3.org/ns/activitystreams"
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
133 "https://w3id.org/security/v1"]
|
||||
136 "https://w3id.org/security/v1"]
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
134 "type" "Delete"
|
||||
137 "type" "Delete"
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
135 "actor" user-id
|
||||
138 "actor" user-id
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
136 "object" data})
|
||||
139 "object" data})
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
137
|
||||
140
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
138 (defn with-config
|
||||
141 (defn with-config
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
139 "Returns curried forms of the #activity and #obj multimethods in the form
|
||||
142 "Returns curried forms of the #activity and #obj multimethods in the form
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
140 {:activity ... :obj ...}, with the initial parameter set to config."
|
||||
143 {:activity ... :obj ...}, with the initial parameter set to config."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
141 [config]
|
||||
144 [config]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 5 forms covered">
|
||||
142 (let [f (juxt
|
||||
145 (let [f (juxt
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 4 forms covered">
|
||||
143 #(partial activity %)
|
||||
146 #(partial activity %)
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 4 forms covered">
|
||||
144 #(partial obj %))
|
||||
147 #(partial obj %))
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 3 forms covered">
|
||||
145 [activity-fn obj-fn] (f config)]
|
||||
148 [activity-fn obj-fn] (f config)]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 4 forms covered">
|
||||
146 {:activity activity-fn
|
||||
149 {:activity activity-fn
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
147 :obj obj-fn}))
|
||||
150 :obj obj-fn}))
|
||||
</span><br/>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -8,109 +8,118 @@
|
|||
001 (ns clj-activitypub.internal.crypto
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
002 (:require [clojure.java.io :as io])
|
||||
002 "copied from [Jahfer's clj-activitypub library](https://github.com/jahfer/clj-activitypub).
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
003 (:import (java.util Base64)
|
||||
003 If and when Jahfer issues a release of that library, this directory will be deleted and a
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
004 (java.security MessageDigest SecureRandom Signature)))
|
||||
004 dependency on that library will be added to the project."
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
005
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
005 (:require [clojure.java.io :as io])
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
006 (java.security.Security/addProvider
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
006 (:import (java.util Base64)
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
007 (org.bouncycastle.jce.provider.BouncyCastleProvider.))
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
007 (java.security MessageDigest SecureRandom Signature)))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
008
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
009 (defn- keydata [reader]
|
||||
009 (java.security.Security/addProvider
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
010 (org.bouncycastle.jce.provider.BouncyCastleProvider.))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
011
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
012 (defn- keydata [reader]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 2 forms covered">
|
||||
010 (->> reader
|
||||
013 (->> reader
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
011 (org.bouncycastle.openssl.PEMParser.)
|
||||
014 (org.bouncycastle.openssl.PEMParser.)
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
012 (.readObject)))
|
||||
015 (.readObject)))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
013
|
||||
016
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
014 (defn- pem-string->key-pair [string]
|
||||
017 (defn- pem-string->key-pair [string]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 6 forms covered">
|
||||
015 (let [kd (keydata (io/reader (.getBytes string)))]
|
||||
018 (let [kd (keydata (io/reader (.getBytes string)))]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 3 forms covered">
|
||||
016 (.getKeyPair (org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter.) kd)))
|
||||
019 (.getKeyPair (org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter.) kd)))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
017
|
||||
020
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
018 (defn private-key [private-pem-str]
|
||||
021 (defn private-key [private-pem-str]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 2 forms covered">
|
||||
019 (-> private-pem-str
|
||||
022 (-> private-pem-str
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 2 forms covered">
|
||||
020 (pem-string->key-pair)
|
||||
023 (pem-string->key-pair)
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
021 (.getPrivate)))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
022
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
023 (defn base64-encode [bytes]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 3 forms covered">
|
||||
024 (.encodeToString (Base64/getEncoder) bytes))
|
||||
024 (.getPrivate)))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
025
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
026 (defn sha256-base64 [data]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 5 forms covered">
|
||||
027 (let [digest (.digest (MessageDigest/getInstance "SHA-256") (.getBytes data))]
|
||||
026 (defn base64-encode [bytes]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 3 forms covered">
|
||||
028 (base64-encode digest)))
|
||||
027 (.encodeToString (Base64/getEncoder) bytes))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
029
|
||||
028
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
030 (defn sign [data private-key]
|
||||
029 (defn sha256-base64 [data]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 2 forms covered">
|
||||
031 (let [bytes (.getBytes data)
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 4 forms covered">
|
||||
032 signer (doto (Signature/getInstance "SHA256withRSA")
|
||||
<span class="not-covered" title="0 out of 5 forms covered">
|
||||
030 (let [digest (.digest (MessageDigest/getInstance "SHA-256") (.getBytes data))]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 3 forms covered">
|
||||
033 (.initSign private-key (SecureRandom.))
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 2 forms covered">
|
||||
034 (.update bytes))]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
035 (.sign signer)))
|
||||
031 (base64-encode digest)))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
036
|
||||
032
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
033 (defn sign [data private-key]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 2 forms covered">
|
||||
034 (let [bytes (.getBytes data)
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 4 forms covered">
|
||||
035 signer (doto (Signature/getInstance "SHA256withRSA")
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 3 forms covered">
|
||||
036 (.initSign private-key (SecureRandom.))
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 2 forms covered">
|
||||
037 (.update bytes))]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
038 (.sign signer)))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
039
|
||||
</span><br/>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -8,76 +8,85 @@
|
|||
001 (ns clj-activitypub.internal.http-util
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
002 (:require [clj-activitypub.internal.crypto :as crypto])
|
||||
002 "copied from [Jahfer's clj-activitypub library](https://github.com/jahfer/clj-activitypub).
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
003 (:import (java.net URLEncoder)
|
||||
003 If and when Jahfer issues a release of that library, this directory will be deleted and a
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
004 (java.time OffsetDateTime ZoneOffset)
|
||||
004 dependency on that library will be added to the project."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
005 (java.time.format DateTimeFormatter)))
|
||||
005 (:require [clj-activitypub.internal.crypto :as crypto])
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
006 (:import (java.net URLEncoder)
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
007 (java.time OffsetDateTime ZoneOffset)
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
008 (java.time.format DateTimeFormatter)))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
006
|
||||
009
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
007 (defn encode-url-params [params]
|
||||
010 (defn encode-url-params [params]
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
008 (->> params
|
||||
011 (->> params
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
009 (reduce-kv
|
||||
012 (reduce-kv
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
010 (fn [coll k v]
|
||||
013 (fn [coll k v]
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
011 (conj coll
|
||||
014 (conj coll
|
||||
</span><br/>
|
||||
<span class="covered" title="11 out of 11 forms covered">
|
||||
012 (str (URLEncoder/encode (name k)) "=" (URLEncoder/encode (str v)))))
|
||||
015 (str (URLEncoder/encode (name k)) "=" (URLEncoder/encode (str v)))))
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
013 [])
|
||||
016 [])
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
014 (interpose "&")
|
||||
017 (interpose "&")
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
015 (apply str)))
|
||||
018 (apply str)))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
016
|
||||
019
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
017 (defn date []
|
||||
020 (defn date []
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 3 forms covered">
|
||||
018 (-> (OffsetDateTime/now (ZoneOffset/UTC))
|
||||
021 (-> (OffsetDateTime/now (ZoneOffset/UTC))
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
019 (.format DateTimeFormatter/RFC_1123_DATE_TIME)))
|
||||
022 (.format DateTimeFormatter/RFC_1123_DATE_TIME)))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
020
|
||||
023
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
021 (defn digest
|
||||
024 (defn digest
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
022 "Accepts body from HTTP request and generates string
|
||||
025 "Accepts body from HTTP request and generates string
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
023 for use in HTTP `Digest` request header."
|
||||
026 for use in HTTP `Digest` request header."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
024 [body]
|
||||
027 [body]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 6 forms covered">
|
||||
025 (str "sha-256=" (crypto/sha256-base64 body)))
|
||||
028 (str "sha-256=" (crypto/sha256-base64 body)))
|
||||
</span><br/>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -5,136 +5,145 @@
|
|||
</head>
|
||||
<body>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
001 (ns clj-activitypub.internal.thread-cache)
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
002
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
003 (defn- current-time
|
||||
001 (ns clj-activitypub.internal.thread-cache
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
004 "Returns current time using UNIX epoch."
|
||||
002 "copied from [Jahfer's clj-activitypub library](https://github.com/jahfer/clj-activitypub).
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
005 []
|
||||
003 If and when Jahfer issues a release of that library, this directory will be deleted and a
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
006 (System/currentTimeMillis))
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
004 dependency on that library will be added to the project.")
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
007
|
||||
005
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
008 (defn- update-read-at [store k v]
|
||||
006 (defn- current-time
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
007 "Returns current time using UNIX epoch."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
008 []
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
009 (System/currentTimeMillis))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
010
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
011 (defn- update-read-at [store k v]
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
009 (dosync
|
||||
012 (dosync
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
010 (commute store assoc k
|
||||
013 (commute store assoc k
|
||||
</span><br/>
|
||||
<span class="covered" title="7 out of 7 forms covered">
|
||||
011 (merge v {:read-at (current-time)}))))
|
||||
014 (merge v {:read-at (current-time)}))))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
012
|
||||
015
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
013 (defn make
|
||||
016 (defn make
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
014 "Creates a thread-local cache."
|
||||
017 "Creates a thread-local cache."
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
015 ([] (make false))
|
||||
018 ([] (make false))
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
016 ([cache-if-nil]
|
||||
019 ([cache-if-nil]
|
||||
</span><br/>
|
||||
<span class="covered" title="4 out of 4 forms covered">
|
||||
017 (let [store (ref {})]
|
||||
020 (let [store (ref {})]
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
018 (letfn [(cache-kv ([k v]
|
||||
021 (letfn [(cache-kv ([k v]
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
019 (dosync
|
||||
022 (dosync
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
020 (commute store assoc k
|
||||
023 (commute store assoc k
|
||||
</span><br/>
|
||||
<span class="covered" title="6 out of 6 forms covered">
|
||||
021 {:write-at (current-time)
|
||||
024 {:write-at (current-time)
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
022 :read-at (current-time)
|
||||
025 :read-at (current-time)
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
023 :value v})
|
||||
026 :value v})
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
024 v)))
|
||||
027 v)))
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
025 (get-v ([k]
|
||||
028 (get-v ([k]
|
||||
</span><br/>
|
||||
<span class="covered" title="11 out of 11 forms covered">
|
||||
026 (when-let [data (get @store k)]
|
||||
029 (when-let [data (get @store k)]
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
027 (update-read-at store k data)
|
||||
030 (update-read-at store k data)
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
028 (:value data)))
|
||||
031 (:value data)))
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
029 ([k compute-fn]
|
||||
032 ([k compute-fn]
|
||||
</span><br/>
|
||||
<span class="covered" title="4 out of 4 forms covered">
|
||||
030 (let [storage @store]
|
||||
033 (let [storage @store]
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
031 (if (contains? storage k)
|
||||
034 (if (contains? storage k)
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
032 (get-v k)
|
||||
035 (get-v k)
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
033 (let [v (compute-fn)]
|
||||
036 (let [v (compute-fn)]
|
||||
</span><br/>
|
||||
<span class="partial" title="11 out of 12 forms covered">
|
||||
034 (when (or (not (nil? v)) cache-if-nil)
|
||||
037 (when (or (not (nil? v)) cache-if-nil)
|
||||
</span><br/>
|
||||
<span class="covered" title="4 out of 4 forms covered">
|
||||
035 (cache-kv k v)
|
||||
038 (cache-kv k v)
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
036 (get-v k)))))))
|
||||
039 (get-v k)))))))
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
037 (lru ([]
|
||||
040 (lru ([]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 2 forms covered">
|
||||
038 (mapv
|
||||
041 (mapv
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 6 forms covered">
|
||||
039 (fn [[k v]] [k (:value v)])
|
||||
042 (fn [[k v]] [k (:value v)])
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 12 forms covered">
|
||||
040 (sort-by #(-> % val :read-at) < @store))))]
|
||||
043 (sort-by #(-> % val :read-at) < @store))))]
|
||||
</span><br/>
|
||||
<span class="covered" title="6 out of 6 forms covered">
|
||||
041 {:cache-kv cache-kv
|
||||
044 {:cache-kv cache-kv
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
042 :get-v get-v
|
||||
045 :get-v get-v
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
043 :cache-if-nil cache-if-nil
|
||||
046 :cache-if-nil cache-if-nil
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
044 :lru lru}))))
|
||||
047 :lru lru}))))
|
||||
</span><br/>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -8,97 +8,106 @@
|
|||
001 (ns clj-activitypub.webfinger
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
002 (:require [clj-http.client :as client]
|
||||
002 "copied from [Jahfer's clj-activitypub library](https://github.com/jahfer/clj-activitypub).
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
003 [clj-activitypub.internal.http-util :as http]
|
||||
003 If and when Jahfer issues a release of that library, this directory will be deleted and a
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
004 [clj-activitypub.internal.thread-cache :as thread-cache]))
|
||||
004 dependency on that library will be added to the project."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
005 (:require [clj-http.client :as client]
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
006 [clj-activitypub.internal.http-util :as http]
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
007 [clj-activitypub.internal.thread-cache :as thread-cache]))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
005
|
||||
008
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
006 (def remote-uri-path "/.well-known/webfinger")
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
007
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
008 (defn- resource-str [domain username]
|
||||
</span><br/>
|
||||
<span class="covered" title="6 out of 6 forms covered">
|
||||
009 (str "acct:" username "@" domain))
|
||||
009 (def remote-uri-path "/.well-known/webfinger")
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
010
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
011 (defn resource-url
|
||||
011 (defn- resource-str [domain username]
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
012 "Builds a URL pointing to the user's account on the remote server."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
013 [domain username & [params]]
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
014 (let [resource (resource-str domain username)
|
||||
</span><br/>
|
||||
<span class="covered" title="8 out of 8 forms covered">
|
||||
015 query-str (http/encode-url-params (merge params {:resource resource}))]
|
||||
</span><br/>
|
||||
<span class="covered" title="7 out of 7 forms covered">
|
||||
016 (str "https://" domain remote-uri-path "?" query-str)))
|
||||
<span class="covered" title="6 out of 6 forms covered">
|
||||
012 (str "acct:" username "@" domain))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
017
|
||||
013
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
018 (def ^:private user-id-cache
|
||||
014 (defn resource-url
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
019 (thread-cache/make))
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
015 "Builds a URL pointing to the user's account on the remote server."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
016 [domain username & [params]]
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
017 (let [resource (resource-str domain username)
|
||||
</span><br/>
|
||||
<span class="covered" title="8 out of 8 forms covered">
|
||||
018 query-str (http/encode-url-params (merge params {:resource resource}))]
|
||||
</span><br/>
|
||||
<span class="covered" title="7 out of 7 forms covered">
|
||||
019 (str "https://" domain remote-uri-path "?" query-str)))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
020
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
021 (defn fetch-user-id
|
||||
021 (def ^:private user-id-cache
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
022 "Follows the webfinger request to a remote domain, retrieving the ID of the requested
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
022 (thread-cache/make))
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
023 account. Typically returns a string in the form of a URL."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
024 [domain username]
|
||||
</span><br/>
|
||||
<span class="covered" title="4 out of 4 forms covered">
|
||||
025 ((:get-v user-id-cache)
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
026 (str domain "@" username) ;; cache key
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
023
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
027 (fn []
|
||||
</span><br/>
|
||||
<span class="partial" title="15 out of 16 forms covered">
|
||||
028 (let [response (some-> (resource-url domain username {:rel "self"})
|
||||
</span><br/>
|
||||
<span class="covered" title="8 out of 8 forms covered">
|
||||
029 (client/get {:as :json :throw-exceptions false :ignore-unknown-host? true}))]
|
||||
</span><br/>
|
||||
<span class="partial" title="27 out of 31 forms covered">
|
||||
030 (some->> response :body :links
|
||||
</span><br/>
|
||||
<span class="covered" title="12 out of 12 forms covered">
|
||||
031 (some #(when (= (:type %) "application/activity+json") %))
|
||||
024 (defn fetch-user-id
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
032 :href)))))
|
||||
025 "Follows the webfinger request to a remote domain, retrieving the ID of the requested
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
026 account. Typically returns a string in the form of a URL."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
027 [domain username]
|
||||
</span><br/>
|
||||
<span class="covered" title="4 out of 4 forms covered">
|
||||
028 ((:get-v user-id-cache)
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
029 (str domain "@" username) ;; cache key
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
030 (fn []
|
||||
</span><br/>
|
||||
<span class="partial" title="15 out of 16 forms covered">
|
||||
031 (let [response (some-> (resource-url domain username {:rel "self"})
|
||||
</span><br/>
|
||||
<span class="covered" title="8 out of 8 forms covered">
|
||||
032 (client/get {:as :json :throw-exceptions false :ignore-unknown-host? true}))]
|
||||
</span><br/>
|
||||
<span class="partial" title="27 out of 31 forms covered">
|
||||
033 (some->> response :body :links
|
||||
</span><br/>
|
||||
<span class="covered" title="12 out of 12 forms covered">
|
||||
034 (some #(when (= (:type %) "application/activity+json") %))
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
035 :href)))))
|
||||
</span><br/>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -1,54 +1,73 @@
|
|||
{"coverage":
|
||||
{"dog_and_duck/quack/quack.clj":
|
||||
[null, 1, null, null, null, null, null, null, null, null, null, null,
|
||||
null, null, null, null, null, null, null, null, null, null, 1, null,
|
||||
null, null, null, null, null, null, null, null, null, null, null,
|
||||
17, null, 1, null, null, null, null, null, true, 5, null, null, 1,
|
||||
null, 1, null, null, null, null, 1, null, null, null, null, null, 1,
|
||||
null, null, 4, null, 1, null, null, null, null, 1, null, null, null,
|
||||
null, 1, null, null, 4, null, 1, null, null, null, null, 1, null,
|
||||
null, null, null, null, null, true, 10, 9, true, 2, null, null,
|
||||
null, true, 2, null, 1, null, null, true, 2, 2, 0, 0, 0, null, null,
|
||||
1, null, null, 0, 0, 0, 0, 0, 0, 0, null, null, null, 1, null, null,
|
||||
0, 0, 0, null, null, 1, null, null, null, null, null, 0, 0, 0, null,
|
||||
null, 1, null, null, null, null, null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
null, null, 0, 0, null, 1, null, null, 0, null, 1, null, null, 0,
|
||||
null, 1, null, null, 0, null, 1, null, null, 0, null, null],
|
||||
null, null, null, null, null, null, null, null, null, null, null,
|
||||
null, null, null, 1, null, null, null, null, null, null, null, null,
|
||||
null, null, null, null, null, null, null, null, null, null, null,
|
||||
40, null, 0, null, 1, null, null, null, null, null, true, 4, null,
|
||||
null, null, null, 1, null, null, null, null, 1, null, null, null,
|
||||
null, null, true, null, null, 5, null, true, null, 1, null, null,
|
||||
null, null, 1, null, null, null, null, true, null, null, 5, null,
|
||||
null, 1, null, null, null, null, null, null, null, null, null, null,
|
||||
null, null, null, null, true, 2, 2, 0, 0, 0, null, null, 1, null,
|
||||
null, null, null, null, null, null, 0, 0, 0, null, null, 1, null,
|
||||
null, 0, 0, 0, 0, 0, 0, 0, null, null, null, 1, null, null, 0, 0, 0,
|
||||
null, null, 1, null, null, null, null, null, 0, 0, 0, null, null, 1,
|
||||
null, null, null, null, null, true, true, true, true, 2, 1, null, 1,
|
||||
1, true, true, 1, null, null, null, null, null, null, null, null, 0,
|
||||
0, 0, 0, null, null, 1, null, null, 0, null, 1, null, null, 0, null,
|
||||
1, null, null, 0, null, 1, null, null, 2, null, null],
|
||||
"dog_and_duck/utils/process.clj":
|
||||
[null, 1, null, null, 1, null, null, null, null, 1, 1, 1, null, true,
|
||||
null, null, null, null, null, null, null, null, null, 1],
|
||||
"clj_activitypub/internal/http_util.clj":
|
||||
[null, 1, null, null, null, null, null, 1, 1, 1, 1, 2, 2, 1, 1, 1,
|
||||
null, 1, 0, 0, null, 1, null, null, null, 0],
|
||||
[null, 1, null, null, null, null, null, null, null, null, 1, 1, 1, 1,
|
||||
2, 2, 1, 1, 1, null, 1, 0, 0, null, 1, null, null, null, 0],
|
||||
"clj_activitypub/internal/thread_cache.clj":
|
||||
[null, 1, null, 1, null, null, 8, null, 1, 4, 4, 4, null, 1, null, 2,
|
||||
null, 2, 2, 2, 2, 2, 2, 2, 2, null, 4, 4, 4, null, 4, 4, 2, 2, true,
|
||||
2, 2, null, 0, 0, 0, 2, 2, 2, 2],
|
||||
[null, 1, null, null, null, null, 1, null, null, 8, null, 1, 4, 4, 4,
|
||||
null, 1, null, 2, null, 2, 2, 2, 2, 2, 2, 2, 2, null, 4, 4, 4, null,
|
||||
4, 4, 2, 2, true, 2, 2, null, 0, 0, 0, 2, 2, 2, 2],
|
||||
"dog_and_duck/scratch/parser.clj":
|
||||
[null, 1, null, null, null, null, null, null, null, null, null, null,
|
||||
null, null, null, null, null, null, null, null, null, null, null,
|
||||
null, 1, null, null, null, 7, 7, 7, 7, 7, true, 0, null, 1, null, 1,
|
||||
0, 0, 0, 0, 0, 0, 1],
|
||||
null, 1, null, null, null, 10, 10, 10, 10, 10, true, 0, null, 1,
|
||||
null, 1, 0, 0, 0, 0, 0, 0, 1, null, 1],
|
||||
"clj_activitypub/core.clj":
|
||||
[null, 1, null, null, null, null, null, null, 1, null, null, null,
|
||||
null, null, 0, 0, 0, 0, 0, 0, 0, 0, null, 1, null, null, null, 6, 2,
|
||||
2, null, 1, 1, null, null, null, 1, 1, 1, 1, null, null, 1, null, 1,
|
||||
null, null, null, 0, null, 0, null, 0, 0, 0, 0, 0, 0, null, 1, null,
|
||||
1, 0, 0, 0, 0, 0, 0, 0, 0, null, 1, null, null, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, null, 1, null, null, null, 0, 0, 0, 0, 0, 0, 0, null, 1,
|
||||
null, null, null, true, null, 1, null, null, null, null, null, 0,
|
||||
null, 0, 0, 0, 0, 0, null, 1, null, null, null, true, null, 1, 0,
|
||||
null, null, 0, 0, null, 1, 0, null, null, 0, 0, null, 1, null, null,
|
||||
null, 0, 0, 0, 0, 0, 0],
|
||||
[null, 1, null, null, null, null, null, null, null, null, null, 1,
|
||||
null, null, null, null, null, 0, 0, 0, 0, 0, 0, 0, 0, null, 1, null,
|
||||
null, null, 6, 2, 2, null, 1, 1, null, null, null, 1, 1, 1, 1, null,
|
||||
null, 1, null, 1, null, null, null, 0, null, 0, null, 0, 0, 0, 0, 0,
|
||||
0, null, 1, null, 1, 0, 0, 0, 0, 0, 0, 0, 0, null, 1, null, null, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, null, 1, null, null, null, 0, 0, 0, 0,
|
||||
0, 0, 0, null, 1, null, null, null, true, null, 1, null, null, null,
|
||||
null, null, 0, null, 0, 0, 0, 0, 0, null, 1, null, null, null, true,
|
||||
null, 1, 0, null, null, 0, 0, null, 1, 0, null, null, 0, 0, null, 1,
|
||||
null, null, null, 0, 0, 0, 0, 0, 0],
|
||||
"clj_activitypub/internal/crypto.clj":
|
||||
[null, 1, null, null, null, null, 1, 1, null, 1, 0, 0, null, null, 1,
|
||||
0, 0, null, 1, 0, 0, null, null, 1, 0, null, 1, 0, 0, null, 1, 0, 0,
|
||||
0, 0, 0, null],
|
||||
[null, 1, null, null, null, null, null, null, null, 1, 1, null, 1, 0,
|
||||
0, null, null, 1, 0, 0, null, 1, 0, 0, null, null, 1, 0, null, 1, 0,
|
||||
0, null, 1, 0, 0, 0, 0, 0, null],
|
||||
"dog_and_duck/quack/picky.clj":
|
||||
[null, 1, null, null, null, null, null, null, null, null, null, null,
|
||||
null, null, null, null, null, null, null, null, null, null, null,
|
||||
null, null, null, null, null, null, null, 1, null, null, null, null,
|
||||
null, null, null, null, null, null, 1, null, 1, null, 1, 1, 1, 1, 1,
|
||||
null, 1, null, null, null, 0, 0, 0, 0, 0, 0, 0, 0, null, 1, null,
|
||||
null, null, null, 1, null, null, null, null, 1, null, null, null,
|
||||
null, null, null, true, 10, 9, true, 2, null, null, null, true,
|
||||
null, null, 3, null, null, null, 1, null, null, null, null, null,
|
||||
null, 0, 0, 0, 0, null, 0, null, 0, null, 0, 0, 0, null, 1, null, 0,
|
||||
0, 0, 0, 0, 0, null, null, null, null, null, 0, 0, null, null, null,
|
||||
null, 0, 0, null, null, null, null, null, null, null],
|
||||
"dog_and_duck/scratch/core.clj":[null, 1, null, 1, null, null, 0],
|
||||
"clj_activitypub/webfinger.clj":
|
||||
[null, 1, null, null, null, null, 1, null, 1, 1, null, 1, null, null,
|
||||
1, 1, 1, null, 1, 1, null, 1, null, null, null, 3, 3, 3, true, 1,
|
||||
true, 2, null],
|
||||
[null, 1, null, null, null, null, null, null, null, 1, null, 1, 1,
|
||||
null, 1, null, null, 1, 1, 1, null, 1, 1, null, 1, null, null, null,
|
||||
3, 3, 3, true, 1, true, 2, null],
|
||||
"dog_and_duck/scratch/scratch.clj":
|
||||
[null, 1, null, null, null, null, null, null, null, null, null, null,
|
||||
null, null, null, null, null, null, null, null, null, null, null,
|
||||
null, null, null, null, null, 1, null, 1, 1, 1, null, null, null,
|
||||
null, 1, null, 1, 1, 1, 1, null, null, 1, null, null, 1, 1, null,
|
||||
null, null, null, 1, 1, 1, 1, 1, 1, null]}}
|
||||
null, null, null, 1, 1, 1, 1, 1, 1, null, null]}}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><report><stats><packages value="9"/><methods value="1223"/><srcfiles value="9"/><srclines value="284"/></stats><data><all name="total"><coverage type="class, %" value="0% (0/1)"/><coverage type="method, %" value="0% (0/1)"/><coverage type="block, %" value="52% (631/1223)"/><coverage type="line, %" value="54% (153/284)"/><package name="dog-and-duck.scratch.scratch"><coverage type="class, %" value="0% (0/1)"/><coverage type="method, %" value="0% (0/1)"/><coverage type="block, %" value="100% (75/75)"/><coverage type="line, %" value="100% (19/19)"/></package><package name="clj-activitypub.internal.thread-cache"><coverage type="class, %" value="0% (0/1)"/><coverage type="method, %" value="0% (0/1)"/><coverage type="block, %" value="83% (105/126)"/><coverage type="line, %" value="88% (30/34)"/></package><package name="clj-activitypub.internal.crypto"><coverage type="class, %" value="0% (0/1)"/><coverage type="method, %" value="0% (0/1)"/><coverage type="block, %" value="19% (9/48)"/><coverage type="line, %" value="39% (9/23)"/></package><package name="dog-and-duck.quack.quack"><coverage type="class, %" value="0% (0/1)"/><coverage type="method, %" value="0% (0/1)"/><coverage type="block, %" value="44% (199/448)"/><coverage type="line, %" value="46% (31/68)"/></package><package name="clj-activitypub.webfinger"><coverage type="class, %" value="0% (0/1)"/><coverage type="method, %" value="0% (0/1)"/><coverage type="block, %" value="96% (107/112)"/><coverage type="line, %" value="89% (16/18)"/></package><package name="clj-activitypub.internal.http-util"><coverage type="class, %" value="0% (0/1)"/><coverage type="method, %" value="0% (0/1)"/><coverage type="block, %" value="74% (29/39)"/><coverage type="line, %" value="80% (12/15)"/></package><package name="dog-and-duck.scratch.core"><coverage type="class, %" value="0% (0/1)"/><coverage type="method, %" value="0% (0/1)"/><coverage type="block, %" value="33% (2/6)"/><coverage type="line, %" value="67% (2/3)"/></package><package name="dog-and-duck.scratch.parser"><coverage type="class, %" value="0% (0/1)"/><coverage type="method, %" value="0% (0/1)"/><coverage type="block, %" value="50% (34/68)"/><coverage type="line, %" value="56% (10/18)"/></package><package name="clj-activitypub.core"><coverage type="class, %" value="0% (0/1)"/><coverage type="method, %" value="0% (0/1)"/><coverage type="block, %" value="24% (71/301)"/><coverage type="line, %" value="28% (24/86)"/></package></all></data></report>
|
||||
<?xml version="1.0" encoding="UTF-8"?><report><stats><packages value="11"/><methods value="1530"/><srcfiles value="11"/><srclines value="340"/></stats><data><all name="total"><coverage type="class, %" value="0% (0/1)"/><coverage type="method, %" value="0% (0/1)"/><coverage type="block, %" value="53% (816/1530)"/><coverage type="line, %" value="52% (177/340)"/><package name="dog-and-duck.scratch.scratch"><coverage type="class, %" value="0% (0/1)"/><coverage type="method, %" value="0% (0/1)"/><coverage type="block, %" value="100% (75/75)"/><coverage type="line, %" value="100% (19/19)"/></package><package name="clj-activitypub.internal.thread-cache"><coverage type="class, %" value="0% (0/1)"/><coverage type="method, %" value="0% (0/1)"/><coverage type="block, %" value="83% (105/126)"/><coverage type="line, %" value="88% (30/34)"/></package><package name="clj-activitypub.internal.crypto"><coverage type="class, %" value="0% (0/1)"/><coverage type="method, %" value="0% (0/1)"/><coverage type="block, %" value="19% (9/48)"/><coverage type="line, %" value="39% (9/23)"/></package><package name="dog-and-duck.quack.quack"><coverage type="class, %" value="0% (0/1)"/><coverage type="method, %" value="0% (0/1)"/><coverage type="block, %" value="48% (237/490)"/><coverage type="line, %" value="43% (29/67)"/></package><package name="clj-activitypub.webfinger"><coverage type="class, %" value="0% (0/1)"/><coverage type="method, %" value="0% (0/1)"/><coverage type="block, %" value="96% (107/112)"/><coverage type="line, %" value="89% (16/18)"/></package><package name="dog-and-duck.quack.picky"><coverage type="class, %" value="0% (0/1)"/><coverage type="method, %" value="0% (0/1)"/><coverage type="block, %" value="50% (113/227)"/><coverage type="line, %" value="39% (19/49)"/></package><package name="clj-activitypub.internal.http-util"><coverage type="class, %" value="0% (0/1)"/><coverage type="method, %" value="0% (0/1)"/><coverage type="block, %" value="74% (29/39)"/><coverage type="line, %" value="80% (12/15)"/></package><package name="dog-and-duck.scratch.core"><coverage type="class, %" value="0% (0/1)"/><coverage type="method, %" value="0% (0/1)"/><coverage type="block, %" value="33% (2/6)"/><coverage type="line, %" value="67% (2/3)"/></package><package name="dog-and-duck.utils.process"><coverage type="class, %" value="0% (0/1)"/><coverage type="method, %" value="0% (0/1)"/><coverage type="block, %" value="86% (25/29)"/><coverage type="line, %" value="86% (6/7)"/></package><package name="dog-and-duck.scratch.parser"><coverage type="class, %" value="0% (0/1)"/><coverage type="method, %" value="0% (0/1)"/><coverage type="block, %" value="56% (43/77)"/><coverage type="line, %" value="58% (11/19)"/></package><package name="clj-activitypub.core"><coverage type="class, %" value="0% (0/1)"/><coverage type="method, %" value="0% (0/1)"/><coverage type="block, %" value="24% (71/301)"/><coverage type="line, %" value="28% (24/86)"/></package></all></data></report>
|
||||
437
docs/cloverage/dog_and_duck/quack/picky.clj.html
Normal file
437
docs/cloverage/dog_and_duck/quack/picky.clj.html
Normal file
|
|
@ -0,0 +1,437 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link rel="stylesheet" href="../../coverage.css"/> <title> dog_and_duck/quack/picky.clj </title>
|
||||
</head>
|
||||
<body>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
001 (ns dog-and-duck.quack.picky "Fault-finder for ActivityPub documents.
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
002
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
003 Generally, each `-faults` function will return:
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
004 1. `nil` if no faults were found;
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
005 2. a sequence of fault objects if faults were found.
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
006
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
007 Each fault object shall have the properties:
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
008 1. `:@context` whose value shall be the URL of a
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
009 document specifying this vocabulary;
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
010 2. `:type` whose value shall be `Fault`;
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
011 3. `:severity` whose value shall be one of
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
012 `minor`, `should`, `must` or `critical`;
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
013 4. `:fault` whose value shall be a unique token
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
014 representing the particular fault type;
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
015 5. `:narrative` whose value shall be a natural
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
016 language description of the fault type.
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
017
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
018 Note that the reason for the `:fault` property is
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
019 to be able to have a well known place, linked to
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
020 from the @context URL, which allows narratives
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
021 for each fault type to be served in as many
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
022 natural languages as possible.
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
023
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
024 The idea further is that it should ultimately be
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
025 possible to serialise a fault report as a
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
026 document which in its own right conforms to the
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
027 ActivityStreams spec."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
028 (:require [dog-and-duck.utils.process :refer [pid]]))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
029
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
030 (def ^:const severity
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
031 "Severity of faults found, as follows:
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
032
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
033 1. `:minor` things which I consider to be faults, but which
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
034 don't actually breach the spec;
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
035 2. `:should` instances where the spec says something SHOULD
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
036 be done, which isn't;
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
037 3. `:must` instances where the spec says something MUST
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
038 be done, which isn't;
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
039 4. `:critical` instances where I believe the fault means that
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
040 the object cannot be meaningfully processed."
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
041 #{:minor :should :must :critical})
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
042
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
043 (def ^:const severity-filters
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
044 "Hack for implementing a severity hierarchy"
|
||||
</span><br/>
|
||||
<span class="covered" title="7 out of 7 forms covered">
|
||||
045 {:all #{}
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
046 :minor #{:minor}
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
047 :should #{:minor :should}
|
||||
</span><br/>
|
||||
<span class="covered" title="4 out of 4 forms covered">
|
||||
048 :must #{:minor :should :must}
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
049 :critical severity})
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
050
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
051 (defn filter-severity
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
052 "Return a list of reports taken from these `reports` where the severity
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
053 of the report is greater than this `severity`."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
054 [reports severity]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 11 forms covered">
|
||||
055 (assert
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 10 forms covered">
|
||||
056 (and
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 3 forms covered">
|
||||
057 (coll? reports)
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 4 forms covered">
|
||||
058 (every? map? reports)
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 2 forms covered">
|
||||
059 (every? :severity reports)))
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 3 forms covered">
|
||||
060 (remove
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 7 forms covered">
|
||||
061 #((severity-filters severity) (:severity %))
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
062 reports))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
063
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
064 (def ^:const activitystreams-context-uri
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
065 "The URI of the context of an ActivityStreams object is expected to be this
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
066 literal string."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
067 "https://www.w3.org/ns/activitystreams")
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
068
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
069 (def ^:const validation-fault-context-uri
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
070 "The URI of the context of a validation fault report object shall be this
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
071 literal string."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
072 "https://simon-brooke.github.io/dog-and-duck/codox/Validation_Faults.html")
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
073
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
074 (defn context?
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
075 "Returns `true` iff `x` quacks like an ActivityStreams context, else false.
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
076
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
077 A context is either
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
078 1. the URI (actually an IRI) `activitystreams-context-uri`, or
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
079 2. a collection comprising that URI and a map."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
080 [x]
|
||||
</span><br/>
|
||||
<span class="partial" title="4 out of 6 forms covered">
|
||||
081 (cond
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
082 (nil? x) false
|
||||
</span><br/>
|
||||
<span class="covered" title="11 out of 11 forms covered">
|
||||
083 (string? x) (and (= x activitystreams-context-uri) true)
|
||||
</span><br/>
|
||||
<span class="partial" title="19 out of 20 forms covered">
|
||||
084 (coll? x) (and (context? (first (remove map? x)))
|
||||
</span><br/>
|
||||
<span class="covered" title="4 out of 4 forms covered">
|
||||
085 (= (count x) 2)
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
086 true)
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
087 :else false))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
088
|
||||
</span><br/>
|
||||
<span class="partial" title="38 out of 40 forms covered">
|
||||
089 (defmacro has-context?
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
090 "True if `x` is an ActivityStreams object with a valid context, else `false`."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
091 [x]
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
092 `(context? ((keyword "@context") ~x)))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
093
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
094
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
095
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
096 (defn make-fault-object
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
097 "Return a fault object with these `severity`, `fault` and `narrative` values.
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
098
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
099 An ActivityPub object MUST have a globally unique ID. Whether this is
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
100 meaningful depends on whether we persist fault report objects and serve
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
101 them, which at present I have no plans to do."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
102 [severity fault narrative]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 9 forms covered">
|
||||
103 (assoc {}
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 4 forms covered">
|
||||
104 (keyword "@context") validation-fault-context-uri
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 5 forms covered">
|
||||
105 :id (str "https://"
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 2 forms covered">
|
||||
106 (.. java.net.InetAddress getLocalHost getHostName)
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
107 "/fault/"
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
108 pid
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
109 ":"
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 3 forms covered">
|
||||
110 (inst-ms (java.util.Date.)))
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
111 :type "Fault"
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
112 :severity severity
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
113 :fault fault
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
114 :narrative narrative))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
115
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
116 (defn object-faults
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
117 [x]
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 2 forms covered">
|
||||
118 (remove
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
119 empty?
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 2 forms covered">
|
||||
120 (list
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 3 forms covered">
|
||||
121 (when-not
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 5 forms covered">
|
||||
122 (has-context? x)
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 5 forms covered">
|
||||
123 (make-fault-object
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
124 :should
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
125 :no-context
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
126 "Section 3 of the ActivityPub specification states
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
127 `Implementers SHOULD include the ActivityPub context in
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
128 their object definitions`.")
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 6 forms covered">
|
||||
129 (when-not (:type x)
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 5 forms covered">
|
||||
130 (make-fault-object
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
131 :minor
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
132 :no-type
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
133 "The ActivityPub specification states that the `type` field is
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
134 optional, but it is hard to process objects with no known type."))
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 7 forms covered">
|
||||
135 (when-not (contains? x :id)
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 5 forms covered">
|
||||
136 (make-fault-object
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
137 :minor
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
138 :no-id-transient
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
139 "The ActivityPub specification allows objects without `id` fields
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
140 only if they are intentionally transient; even so it is preferred
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
141 that the object should have an explicit null id."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
142 ))
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
143 ))))
|
||||
</span><br/>
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -139,5 +139,11 @@
|
|||
<span class="covered" title="5 out of 5 forms covered">
|
||||
045 (file-seq (file "resources/activitystreams-test-documents")))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
046
|
||||
</span><br/>
|
||||
<span class="covered" title="9 out of 9 forms covered">
|
||||
047 (-> "resources/activitystreams-test-documents/simple0020.json" slurp clean first :actor)
|
||||
</span><br/>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@
|
|||
044 ;;; examine what you got back!
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
045 (:outbox account)
|
||||
045 (:inbox account)
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
046
|
||||
|
|
@ -184,5 +184,8 @@
|
|||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
060 )
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
061
|
||||
</span><br/>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
77
docs/cloverage/dog_and_duck/utils/process.clj.html
Normal file
77
docs/cloverage/dog_and_duck/utils/process.clj.html
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link rel="stylesheet" href="../../coverage.css"/> <title> dog_and_duck/utils/process.clj </title>
|
||||
</head>
|
||||
<body>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
001 (ns dog-and-duck.utils.process
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
002 (:require [clojure.string :refer [split]]))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
003
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
004 (def pid
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
005 "OK, this is hacky as fuck, but I hope it works. The problem is that the
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
006 way to get the process id has changed several times during the history
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
007 of Java development, and the code for one version of Java won't even compile
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
008 in a different version."
|
||||
</span><br/>
|
||||
<span class="covered" title="9 out of 9 forms covered">
|
||||
009 (let [java-version (read-string (apply str (take 2
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
010 (split
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
011 (System/getProperty "java.version")
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
012 #"[_\.]"))))
|
||||
</span><br/>
|
||||
<span class="partial" title="4 out of 8 forms covered">
|
||||
013 cmd (case java-version
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
014 18 "(let [[_ pid hostname]
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
015 (re-find
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
016 #\"^(\\d+)@(.*)\"
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
017 (.getName
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
018 (java.lang.management.ManagementFactory/getRuntimeMXBean)))]
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
019 pid)"
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
020 (19 110) "(.pid (java.lang.ProcessHandle/current))"
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
021 111 "(.getPid (java.lang.management.ManagementFactory/getRuntimeMXBean))"
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
022 ":default")]
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
023 (eval (read-string cmd))))
|
||||
</span><br/>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
style="width:69.76744186046511%;
|
||||
float:left;"> 60 </div></td>
|
||||
<td class="with-number">30.23 %</td>
|
||||
<td class="with-number">147</td><td class="with-number">14</td><td class="with-number">86</td>
|
||||
<td class="with-number">150</td><td class="with-number">14</td><td class="with-number">86</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="clj_activitypub/internal/crypto.clj.html">clj-activitypub.internal.crypto</a></td><td class="with-bar"><div class="covered"
|
||||
|
|
@ -44,7 +44,7 @@
|
|||
style="width:60.869565217391305%;
|
||||
float:left;"> 14 </div></td>
|
||||
<td class="with-number">39.13 %</td>
|
||||
<td class="with-number">36</td><td class="with-number">8</td><td class="with-number">23</td>
|
||||
<td class="with-number">39</td><td class="with-number">8</td><td class="with-number">23</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="clj_activitypub/internal/http_util.clj.html">clj-activitypub.internal.http-util</a></td><td class="with-bar"><div class="covered"
|
||||
|
|
@ -59,7 +59,7 @@
|
|||
style="width:20.0%;
|
||||
float:left;"> 3 </div></td>
|
||||
<td class="with-number">80.00 %</td>
|
||||
<td class="with-number">25</td><td class="with-number">3</td><td class="with-number">15</td>
|
||||
<td class="with-number">28</td><td class="with-number">3</td><td class="with-number">15</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="clj_activitypub/internal/thread_cache.clj.html">clj-activitypub.internal.thread-cache</a></td><td class="with-bar"><div class="covered"
|
||||
|
|
@ -76,7 +76,7 @@
|
|||
style="width:8.823529411764707%;
|
||||
float:left;"> 3 </div></td>
|
||||
<td class="with-number">91.18 %</td>
|
||||
<td class="with-number">44</td><td class="with-number">3</td><td class="with-number">34</td>
|
||||
<td class="with-number">47</td><td class="with-number">3</td><td class="with-number">34</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="clj_activitypub/webfinger.clj.html">clj-activitypub.webfinger</a></td><td class="with-bar"><div class="covered"
|
||||
|
|
@ -91,24 +91,41 @@
|
|||
style="width:11.11111111111111%;
|
||||
float:left;"> 2 </div></td>
|
||||
<td class="with-number">100.00 %</td>
|
||||
<td class="with-number">32</td><td class="with-number">5</td><td class="with-number">18</td>
|
||||
<td class="with-number">35</td><td class="with-number">5</td><td class="with-number">18</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="dog_and_duck/quack/picky.clj.html">dog-and-duck.quack.picky</a></td><td class="with-bar"><div class="covered"
|
||||
style="width:49.779735682819386%;
|
||||
float:left;"> 113 </div><div class="not-covered"
|
||||
style="width:50.220264317180614%;
|
||||
float:left;"> 114 </div></td>
|
||||
<td class="with-number">49.78 %</td>
|
||||
<td class="with-bar"><div class="covered"
|
||||
style="width:38.775510204081634%;
|
||||
float:left;"> 19 </div><div class="partial"
|
||||
style="width:6.122448979591836%;
|
||||
float:left;"> 3 </div><div class="not-covered"
|
||||
style="width:55.10204081632653%;
|
||||
float:left;"> 27 </div></td>
|
||||
<td class="with-number">44.90 %</td>
|
||||
<td class="with-number">143</td><td class="with-number">11</td><td class="with-number">49</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="dog_and_duck/quack/quack.clj.html">dog-and-duck.quack.quack</a></td><td class="with-bar"><div class="covered"
|
||||
style="width:44.419642857142854%;
|
||||
float:left;"> 199 </div><div class="not-covered"
|
||||
style="width:55.580357142857146%;
|
||||
float:left;"> 249 </div></td>
|
||||
<td class="with-number">44.42 %</td>
|
||||
style="width:48.36734693877551%;
|
||||
float:left;"> 237 </div><div class="not-covered"
|
||||
style="width:51.63265306122449%;
|
||||
float:left;"> 253 </div></td>
|
||||
<td class="with-number">48.37 %</td>
|
||||
<td class="with-bar"><div class="covered"
|
||||
style="width:45.588235294117645%;
|
||||
float:left;"> 31 </div><div class="partial"
|
||||
style="width:7.352941176470588%;
|
||||
float:left;"> 5 </div><div class="not-covered"
|
||||
style="width:47.05882352941177%;
|
||||
float:left;"> 32 </div></td>
|
||||
<td class="with-number">52.94 %</td>
|
||||
<td class="with-number">187</td><td class="with-number">26</td><td class="with-number">68</td>
|
||||
style="width:43.28358208955224%;
|
||||
float:left;"> 29 </div><div class="partial"
|
||||
style="width:16.417910447761194%;
|
||||
float:left;"> 11 </div><div class="not-covered"
|
||||
style="width:40.298507462686565%;
|
||||
float:left;"> 27 </div></td>
|
||||
<td class="with-number">59.70 %</td>
|
||||
<td class="with-number">227</td><td class="with-number">26</td><td class="with-number">67</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="dog_and_duck/scratch/core.clj.html">dog-and-duck.scratch.core</a></td><td class="with-bar"><div class="covered"
|
||||
|
|
@ -127,20 +144,20 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td><a href="dog_and_duck/scratch/parser.clj.html">dog-and-duck.scratch.parser</a></td><td class="with-bar"><div class="covered"
|
||||
style="width:50.0%;
|
||||
float:left;"> 34 </div><div class="not-covered"
|
||||
style="width:50.0%;
|
||||
style="width:55.84415584415584%;
|
||||
float:left;"> 43 </div><div class="not-covered"
|
||||
style="width:44.15584415584416%;
|
||||
float:left;"> 34 </div></td>
|
||||
<td class="with-number">50.00 %</td>
|
||||
<td class="with-number">55.84 %</td>
|
||||
<td class="with-bar"><div class="covered"
|
||||
style="width:55.55555555555556%;
|
||||
float:left;"> 10 </div><div class="partial"
|
||||
style="width:5.555555555555555%;
|
||||
style="width:57.89473684210526%;
|
||||
float:left;"> 11 </div><div class="partial"
|
||||
style="width:5.2631578947368425%;
|
||||
float:left;"> 1 </div><div class="not-covered"
|
||||
style="width:38.888888888888886%;
|
||||
style="width:36.8421052631579%;
|
||||
float:left;"> 7 </div></td>
|
||||
<td class="with-number">61.11 %</td>
|
||||
<td class="with-number">45</td><td class="with-number">7</td><td class="with-number">18</td>
|
||||
<td class="with-number">63.16 %</td>
|
||||
<td class="with-number">47</td><td class="with-number">8</td><td class="with-number">19</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="dog_and_duck/scratch/scratch.clj.html">dog-and-duck.scratch.scratch</a></td><td class="with-bar"><div class="covered"
|
||||
|
|
@ -151,13 +168,28 @@
|
|||
style="width:100.0%;
|
||||
float:left;"> 19 </div></td>
|
||||
<td class="with-number">100.00 %</td>
|
||||
<td class="with-number">60</td><td class="with-number">9</td><td class="with-number">19</td>
|
||||
<td class="with-number">61</td><td class="with-number">10</td><td class="with-number">19</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="dog_and_duck/utils/process.clj.html">dog-and-duck.utils.process</a></td><td class="with-bar"><div class="covered"
|
||||
style="width:86.20689655172414%;
|
||||
float:left;"> 25 </div><div class="not-covered"
|
||||
style="width:13.793103448275861%;
|
||||
float:left;"> 4 </div></td>
|
||||
<td class="with-number">86.21 %</td>
|
||||
<td class="with-bar"><div class="covered"
|
||||
style="width:85.71428571428571%;
|
||||
float:left;"> 6 </div><div class="partial"
|
||||
style="width:14.285714285714286%;
|
||||
float:left;"> 1 </div></td>
|
||||
<td class="with-number">100.00 %</td>
|
||||
<td class="with-number">23</td><td class="with-number">1</td><td class="with-number">7</td>
|
||||
</tr>
|
||||
<tr><td>Totals:</td>
|
||||
<td class="with-bar"></td>
|
||||
<td class="with-number">51.59 %</td>
|
||||
<td class="with-number">53.33 %</td>
|
||||
<td class="with-bar"></td>
|
||||
<td class="with-number">57.75 %</td>
|
||||
<td class="with-number">58.24 %</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue