Proof of concept of 'picky' validator now working.
This commit is contained in:
parent
b8d5b66148
commit
1b2adb5296
|
@ -7,7 +7,7 @@
|
||||||
null, null, null, 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,
|
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, null, 1, null, null, null, null, 1, null, null, null,
|
||||||
null, null, true, null, null, 5, null, true, null, 1, null, null,
|
null, null, true, null, null, 5, null, null, null, 1, null, true,
|
||||||
null, null, 1, null, null, null, null, true, null, null, 5, 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, 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, true, 2, 2, 0, 0, 0, null, null, 1, null,
|
||||||
|
@ -51,15 +51,20 @@
|
||||||
"dog_and_duck/quack/picky.clj":
|
"dog_and_duck/quack/picky.clj":
|
||||||
[null, 1, 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, 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, null, null, null, 1,
|
||||||
null, null, null, null, null, null, 1, null, 1, null, 1, 1, 1, 1, 1,
|
null, null, null, null, null, null, null, null, null, null, 1, null,
|
||||||
null, 1, null, null, null, 0, 0, 0, 0, 0, 0, 0, 0, null, 1, null,
|
1, null, 1, 1, 1, 1, 1, null, 1, null, null, null, true, true, 7, 7,
|
||||||
null, null, null, 1, null, null, null, null, 1, null, null, null,
|
7, 7, 12, 7, null, 1, null, null, null, null, 1, null, null, null,
|
||||||
null, null, null, true, 10, 9, true, 2, null, null, null, true,
|
null, 1, null, null, null, null, null, null, true, 22, 18, true, 2,
|
||||||
null, null, 3, null, null, null, 1, null, null, null, null, null,
|
null, null, null, 12, null, null, 3, null, 1, null, null, null,
|
||||||
null, 0, 0, 0, 0, null, 0, null, 0, null, 0, 0, 0, null, 1, null, 0,
|
null, null, null, null, null, 14, 14, 14, 14, null, 14, null, 14,
|
||||||
0, 0, 0, 0, 0, null, null, null, null, null, 0, 0, null, null, null,
|
null, 14, 14, 14, null, 1, null, null, 12, 12, 12, 12, 1, null,
|
||||||
null, 0, 0, null, null, null, null, null, null, null],
|
null, 12, 12, 3, null, null, 12, 3, null, null, 12, 4, null, null,
|
||||||
|
12, null, 1, null, null, 5, 5, 5, 5, 5, 4, 3, 1, null, 1, null, 0,
|
||||||
|
1, 5, null],
|
||||||
|
"dog_and_duck/quack/fault_messages.clj":
|
||||||
|
[null, 1, null, 1, null, 1, null, null, null, null, null, null,
|
||||||
|
null],
|
||||||
"dog_and_duck/scratch/core.clj":[null, 1, null, 1, null, null, 0],
|
"dog_and_duck/scratch/core.clj":[null, 1, null, 1, null, null, 0],
|
||||||
"clj_activitypub/webfinger.clj":
|
"clj_activitypub/webfinger.clj":
|
||||||
[null, 1, null, null, null, null, null, null, null, 1, null, 1, 1,
|
[null, 1, null, null, null, null, null, null, null, 1, null, 1, 1,
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
<?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>
|
<?xml version="1.0" encoding="UTF-8"?><report><stats><packages value="12"/><methods value="1623"/><srcfiles value="12"/><srclines value="359"/></stats><data><all name="total"><coverage type="class, %" value="0% (0/1)"/><coverage type="method, %" value="0% (0/1)"/><coverage type="block, %" value="62% (1005/1623)"/><coverage type="line, %" value="62% (221/359)"/><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="dog-and-duck.quack.fault-messages"><coverage type="class, %" value="0% (0/1)"/><coverage type="method, %" value="0% (0/1)"/><coverage type="block, %" value="100% (19/19)"/><coverage type="line, %" value="100% (3/3)"/></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="94% (283/301)"/><coverage type="line, %" value="92% (60/65)"/></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>
|
44
docs/cloverage/dog_and_duck/quack/fault_messages.clj.html
Normal file
44
docs/cloverage/dog_and_duck/quack/fault_messages.clj.html
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<link rel="stylesheet" href="../../coverage.css"/> <title> dog_and_duck/quack/fault_messages.clj </title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<span class="covered" title="1 out of 1 forms covered">
|
||||||
|
001 (ns dog-and-duck.quack.fault-messages)
|
||||||
|
</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 (def messages
|
||||||
|
</span><br/>
|
||||||
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
|
004 "Actual fault messages to which fault codes resolve."
|
||||||
|
</span><br/>
|
||||||
|
<span class="covered" title="17 out of 17 forms covered">
|
||||||
|
005 {:id-not-https "Publicly facing content SHOULD use HTTPS URIs"
|
||||||
|
</span><br/>
|
||||||
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
|
006 :id-not-uri "identifiers must be publicly dereferencable URIs"
|
||||||
|
</span><br/>
|
||||||
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
|
007 :no-context "Section 3 of the ActivityPub specification states Implementers SHOULD include the ActivityPub context in their object definitions`."
|
||||||
|
</span><br/>
|
||||||
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
|
008 :no-id-persistent "Persistent objects MUST have unique global identifiers."
|
||||||
|
</span><br/>
|
||||||
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
|
009 :no-id-transient "The ActivityPub specification allows objects without `id` fields only if they are intentionally transient; even so it is preferred that the object should have an explicit null id."
|
||||||
|
</span><br/>
|
||||||
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
|
010 :null-id-persistent "Persistent objects MUST have non-null identifiers."
|
||||||
|
</span><br/>
|
||||||
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
|
011 :no-type "The ActivityPub specification states that the `type` field is optional, but it is hard to process objects with no known type."
|
||||||
|
</span><br/>
|
||||||
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
|
012 :not-an-object "ActivityStreams object must be JSON objects."})
|
||||||
|
</span><br/>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -14,424 +14,481 @@
|
||||||
003 Generally, each `-faults` function will return:
|
003 Generally, each `-faults` function will return:
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
004 1. `nil` if no faults were found;
|
004
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
005 2. a sequence of fault objects if faults were found.
|
005 1. `nil` if no faults were found;
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
006
|
006 2. a sequence of fault objects if faults were found.
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
007 Each fault object shall have the properties:
|
007
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
008 1. `:@context` whose value shall be the URL of a
|
008 Each fault object shall have the properties:
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
009 document specifying this vocabulary;
|
009
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
010 2. `:type` whose value shall be `Fault`;
|
010 1. `:@context` whose value shall be the URL of a
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
011 3. `:severity` whose value shall be one of
|
011 document specifying this vocabulary;
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
012 `minor`, `should`, `must` or `critical`;
|
012 2. `:type` whose value shall be `Fault`;
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
013 4. `:fault` whose value shall be a unique token
|
013 3. `:severity` whose value shall be one of
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
014 representing the particular fault type;
|
014 `minor`, `should`, `must` or `critical`;
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
015 5. `:narrative` whose value shall be a natural
|
015 4. `:fault` whose value shall be a unique token
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
016 language description of the fault type.
|
016 representing the particular fault type;
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
017
|
017 5. `:narrative` whose value shall be a natural
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
018 Note that the reason for the `:fault` property is
|
018 language description of the fault type.
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
019 to be able to have a well known place, linked to
|
019
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
020 from the @context URL, which allows narratives
|
020 Note that the reason for the `:fault` property is
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
021 for each fault type to be served in as many
|
021 to be able to have a well known place, linked to
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
022 natural languages as possible.
|
022 from the @context URL, which allows narratives
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
023
|
023 for each fault type to be served in as many
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
024 The idea further is that it should ultimately be
|
024 natural languages as possible.
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
025 possible to serialise a fault report as a
|
025
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
026 document which in its own right conforms to the
|
026 The idea further is that it should ultimately be
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
027 ActivityStreams spec."
|
027 possible to serialise a fault report as a
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
028 (:require [dog-and-duck.utils.process :refer [pid]]))
|
028 document which in its own right conforms to the
|
||||||
|
</span><br/>
|
||||||
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
|
029 ActivityStreams spec."
|
||||||
|
</span><br/>
|
||||||
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
|
030 (:require [dog-and-duck.quack.fault-messages :refer [messages]]
|
||||||
|
</span><br/>
|
||||||
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
|
031 [dog-and-duck.utils.process :refer [pid]])
|
||||||
|
</span><br/>
|
||||||
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
|
032 (:import [java.net URI URISyntaxException]))
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="blank" title="0 out of 0 forms covered">
|
<span class="blank" title="0 out of 0 forms covered">
|
||||||
029
|
033
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="covered" title="1 out of 1 forms covered">
|
<span class="covered" title="1 out of 1 forms covered">
|
||||||
030 (def ^:const severity
|
034 (def ^:const severity
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
031 "Severity of faults found, as follows:
|
035 "Severity of faults found, as follows:
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
032
|
036
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
033 1. `:minor` things which I consider to be faults, but which
|
037 1. `:minor` things which I consider to be faults, but which
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
034 don't actually breach the spec;
|
038 don't actually breach the spec;
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
035 2. `:should` instances where the spec says something SHOULD
|
039 2. `:should` instances where the spec says something SHOULD
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
036 be done, which isn't;
|
040 be done, which isn't;
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
037 3. `:must` instances where the spec says something MUST
|
041 3. `:must` instances where the spec says something MUST
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
038 be done, which isn't;
|
042 be done, which isn't;
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
039 4. `:critical` instances where I believe the fault means that
|
043 4. `:critical` instances where I believe the fault means that
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
040 the object cannot be meaningfully processed."
|
044 the object cannot be meaningfully processed."
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="covered" title="5 out of 5 forms covered">
|
<span class="covered" title="5 out of 5 forms covered">
|
||||||
041 #{:minor :should :must :critical})
|
045 #{:minor :should :must :critical})
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="blank" title="0 out of 0 forms covered">
|
<span class="blank" title="0 out of 0 forms covered">
|
||||||
042
|
046
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="covered" title="1 out of 1 forms covered">
|
<span class="covered" title="1 out of 1 forms covered">
|
||||||
043 (def ^:const severity-filters
|
047 (def ^:const severity-filters
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
044 "Hack for implementing a severity hierarchy"
|
048 "Hack for implementing a severity hierarchy"
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="covered" title="7 out of 7 forms covered">
|
<span class="covered" title="7 out of 7 forms covered">
|
||||||
045 {:all #{}
|
049 {:all #{}
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="covered" title="2 out of 2 forms covered">
|
<span class="covered" title="2 out of 2 forms covered">
|
||||||
046 :minor #{:minor}
|
050 :minor #{:minor}
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="covered" title="3 out of 3 forms covered">
|
<span class="covered" title="3 out of 3 forms covered">
|
||||||
047 :should #{:minor :should}
|
051 :should #{:minor :should}
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="covered" title="4 out of 4 forms covered">
|
<span class="covered" title="4 out of 4 forms covered">
|
||||||
048 :must #{:minor :should :must}
|
052 :must #{:minor :should :must}
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="covered" title="1 out of 1 forms covered">
|
<span class="covered" title="1 out of 1 forms covered">
|
||||||
049 :critical severity})
|
053 :critical severity})
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="blank" title="0 out of 0 forms covered">
|
<span class="blank" title="0 out of 0 forms covered">
|
||||||
050
|
054
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="covered" title="1 out of 1 forms covered">
|
<span class="covered" title="1 out of 1 forms covered">
|
||||||
051 (defn filter-severity
|
055 (defn filter-severity
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
052 "Return a list of reports taken from these `reports` where the severity
|
056 "Return a list of reports taken from these `reports` where the severity
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
053 of the report is greater than this `severity`."
|
057 of the report is greater than this `severity`."
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
054 [reports severity]
|
058 [reports severity]
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-covered" title="0 out of 11 forms covered">
|
<span class="partial" title="2 out of 11 forms covered">
|
||||||
055 (assert
|
059 (assert
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-covered" title="0 out of 10 forms covered">
|
<span class="partial" title="8 out of 10 forms covered">
|
||||||
056 (and
|
060 (and
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-covered" title="0 out of 3 forms covered">
|
<span class="covered" title="3 out of 3 forms covered">
|
||||||
057 (coll? reports)
|
061 (coll? reports)
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-covered" title="0 out of 4 forms covered">
|
<span class="covered" title="4 out of 4 forms covered">
|
||||||
058 (every? map? reports)
|
062 (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><br/>
|
||||||
<span class="covered" title="2 out of 2 forms covered">
|
<span class="covered" title="2 out of 2 forms covered">
|
||||||
064 (def ^:const activitystreams-context-uri
|
063 (every? :severity reports)))
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="covered" title="3 out of 3 forms covered">
|
||||||
065 "The URI of the context of an ActivityStreams object is expected to be this
|
064 (remove
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="covered" title="7 out of 7 forms covered">
|
||||||
066 literal string."
|
065 #((severity-filters severity) (:severity %))
|
||||||
</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><br/>
|
||||||
<span class="covered" title="1 out of 1 forms covered">
|
<span class="covered" title="1 out of 1 forms covered">
|
||||||
074 (defn context?
|
066 reports))
|
||||||
|
</span><br/>
|
||||||
|
<span class="blank" title="0 out of 0 forms covered">
|
||||||
|
067
|
||||||
|
</span><br/>
|
||||||
|
<span class="covered" title="2 out of 2 forms covered">
|
||||||
|
068 (def ^:const activitystreams-context-uri
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
075 "Returns `true` iff `x` quacks like an ActivityStreams context, else false.
|
069 "The URI of the context of an ActivityStreams object is expected to be this
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
076
|
070 literal string."
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
077 A context is either
|
071 "https://www.w3.org/ns/activitystreams")
|
||||||
|
</span><br/>
|
||||||
|
<span class="blank" title="0 out of 0 forms covered">
|
||||||
|
072
|
||||||
|
</span><br/>
|
||||||
|
<span class="covered" title="2 out of 2 forms covered">
|
||||||
|
073 (def ^:const validation-fault-context-uri
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
078 1. the URI (actually an IRI) `activitystreams-context-uri`, or
|
074 "The URI of the context of a validation fault report object shall be this
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
079 2. a collection comprising that URI and a map."
|
075 literal string."
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
080 [x]
|
076 "https://simon-brooke.github.io/dog-and-duck/codox/Validation_Faults.html")
|
||||||
|
</span><br/>
|
||||||
|
<span class="blank" title="0 out of 0 forms covered">
|
||||||
|
077
|
||||||
|
</span><br/>
|
||||||
|
<span class="covered" title="1 out of 1 forms covered">
|
||||||
|
078 (defn context?
|
||||||
|
</span><br/>
|
||||||
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
|
079 "Returns `true` iff `x` quacks like an ActivityStreams context, else false.
|
||||||
|
</span><br/>
|
||||||
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
|
080
|
||||||
|
</span><br/>
|
||||||
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
|
081 A context is either
|
||||||
|
</span><br/>
|
||||||
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
|
082 1. the URI (actually an IRI) `activitystreams-context-uri`, or
|
||||||
|
</span><br/>
|
||||||
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
|
083 2. a collection comprising that URI and a map."
|
||||||
|
</span><br/>
|
||||||
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
|
084 [x]
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="partial" title="4 out of 6 forms covered">
|
<span class="partial" title="4 out of 6 forms covered">
|
||||||
081 (cond
|
085 (cond
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="covered" title="3 out of 3 forms covered">
|
<span class="covered" title="3 out of 3 forms covered">
|
||||||
082 (nil? x) false
|
086 (nil? x) false
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="covered" title="11 out of 11 forms covered">
|
<span class="covered" title="11 out of 11 forms covered">
|
||||||
083 (string? x) (and (= x activitystreams-context-uri) true)
|
087 (string? x) (and (= x activitystreams-context-uri) true)
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="partial" title="19 out of 20 forms covered">
|
<span class="partial" title="19 out of 20 forms covered">
|
||||||
084 (coll? x) (and (context? (first (remove map? x)))
|
088 (coll? x) (and (context? (first (remove map? x)))
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="covered" title="4 out of 4 forms covered">
|
<span class="covered" title="4 out of 4 forms covered">
|
||||||
085 (= (count x) 2)
|
089 (= (count x) 2)
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
086 true)
|
090 true)
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
087 :else false))
|
091 :else false))
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="blank" title="0 out of 0 forms covered">
|
<span class="blank" title="0 out of 0 forms covered">
|
||||||
088
|
092
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="partial" title="38 out of 40 forms covered">
|
<span class="covered" title="40 out of 40 forms covered">
|
||||||
089 (defmacro has-context?
|
093 (defmacro has-context?
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<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`."
|
094 "True if `x` is an ActivityStreams object with a valid context, else `false`."
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
091 [x]
|
095 [x]
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="covered" title="1 out of 1 forms covered">
|
<span class="covered" title="1 out of 1 forms covered">
|
||||||
092 `(context? ((keyword "@context") ~x)))
|
096 `(context? ((keyword "@context") ~x)))
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="blank" title="0 out of 0 forms covered">
|
<span class="blank" title="0 out of 0 forms covered">
|
||||||
093
|
097
|
||||||
</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><br/>
|
||||||
<span class="covered" title="1 out of 1 forms covered">
|
<span class="covered" title="1 out of 1 forms covered">
|
||||||
096 (defn make-fault-object
|
098 (defn make-fault-object
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
097 "Return a fault object with these `severity`, `fault` and `narrative` values.
|
099 "Return a fault object with these `severity`, `fault` and `narrative` values.
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
098
|
100
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
099 An ActivityPub object MUST have a globally unique ID. Whether this is
|
101 An ActivityPub object MUST have a globally unique ID. Whether this is
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
100 meaningful depends on whether we persist fault report objects and serve
|
102 meaningful depends on whether we persist fault report objects and serve
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
101 them, which at present I have no plans to do."
|
103 them, which at present I have no plans to do."
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
102 [severity fault narrative]
|
104 ;; TODO: should not pass in the narrative; instead should use the :fault value
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-covered" title="0 out of 9 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
103 (assoc {}
|
105 ;; to look up the narrative in a resource file.
|
||||||
|
</span><br/>
|
||||||
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
|
106 [severity fault]
|
||||||
|
</span><br/>
|
||||||
|
<span class="covered" title="9 out of 9 forms covered">
|
||||||
|
107 (assoc {}
|
||||||
|
</span><br/>
|
||||||
|
<span class="covered" title="4 out of 4 forms covered">
|
||||||
|
108 (keyword "@context") validation-fault-context-uri
|
||||||
|
</span><br/>
|
||||||
|
<span class="covered" title="5 out of 5 forms covered">
|
||||||
|
109 :id (str "https://"
|
||||||
|
</span><br/>
|
||||||
|
<span class="covered" title="2 out of 2 forms covered">
|
||||||
|
110 (.. java.net.InetAddress getLocalHost getHostName)
|
||||||
|
</span><br/>
|
||||||
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
|
111 "/fault/"
|
||||||
|
</span><br/>
|
||||||
|
<span class="covered" title="1 out of 1 forms covered">
|
||||||
|
112 pid
|
||||||
|
</span><br/>
|
||||||
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
|
113 ":"
|
||||||
|
</span><br/>
|
||||||
|
<span class="covered" title="3 out of 3 forms covered">
|
||||||
|
114 (inst-ms (java.util.Date.)))
|
||||||
|
</span><br/>
|
||||||
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
|
115 :type "Fault"
|
||||||
|
</span><br/>
|
||||||
|
<span class="covered" title="1 out of 1 forms covered">
|
||||||
|
116 :severity severity
|
||||||
|
</span><br/>
|
||||||
|
<span class="covered" title="1 out of 1 forms covered">
|
||||||
|
117 :fault fault
|
||||||
|
</span><br/>
|
||||||
|
<span class="covered" title="3 out of 3 forms covered">
|
||||||
|
118 :narrative (messages fault)))
|
||||||
|
</span><br/>
|
||||||
|
<span class="blank" title="0 out of 0 forms covered">
|
||||||
|
119
|
||||||
|
</span><br/>
|
||||||
|
<span class="covered" title="1 out of 1 forms covered">
|
||||||
|
120 (defn object-faults
|
||||||
|
</span><br/>
|
||||||
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
|
121 "Return a list of faults found in object `x`, or `nil` if none are."
|
||||||
|
</span><br/>
|
||||||
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
|
122 [x]
|
||||||
|
</span><br/>
|
||||||
|
<span class="covered" title="3 out of 3 forms covered">
|
||||||
|
123 (let [faults (remove
|
||||||
|
</span><br/>
|
||||||
|
<span class="covered" title="1 out of 1 forms covered">
|
||||||
|
124 empty?
|
||||||
|
</span><br/>
|
||||||
|
<span class="covered" title="2 out of 2 forms covered">
|
||||||
|
125 (list
|
||||||
|
</span><br/>
|
||||||
|
<span class="covered" title="6 out of 6 forms covered">
|
||||||
|
126 (when-not (map? x)
|
||||||
|
</span><br/>
|
||||||
|
<span class="covered" title="4 out of 4 forms covered">
|
||||||
|
127 (make-fault-object
|
||||||
|
</span><br/>
|
||||||
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
|
128 :critical
|
||||||
|
</span><br/>
|
||||||
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
|
129 :not-an-object))
|
||||||
|
</span><br/>
|
||||||
|
<span class="covered" title="3 out of 3 forms covered">
|
||||||
|
130 (when-not
|
||||||
|
</span><br/>
|
||||||
|
<span class="covered" title="5 out of 5 forms covered">
|
||||||
|
131 (has-context? x)
|
||||||
|
</span><br/>
|
||||||
|
<span class="covered" title="4 out of 4 forms covered">
|
||||||
|
132 (make-fault-object
|
||||||
|
</span><br/>
|
||||||
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
|
133 :should
|
||||||
|
</span><br/>
|
||||||
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
|
134 :no-context))
|
||||||
|
</span><br/>
|
||||||
|
<span class="covered" title="6 out of 6 forms covered">
|
||||||
|
135 (when-not (:type x)
|
||||||
|
</span><br/>
|
||||||
|
<span class="covered" title="4 out of 4 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-type))
|
||||||
|
</span><br/>
|
||||||
|
<span class="covered" title="14 out of 14 forms covered">
|
||||||
|
139 (when-not (and (map? x) (contains? x :id))
|
||||||
|
</span><br/>
|
||||||
|
<span class="covered" title="4 out of 4 forms covered">
|
||||||
|
140 (make-fault-object
|
||||||
|
</span><br/>
|
||||||
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
|
141 :minor
|
||||||
|
</span><br/>
|
||||||
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
|
142 :no-id-transient))))]
|
||||||
|
</span><br/>
|
||||||
|
<span class="covered" title="6 out of 6 forms covered">
|
||||||
|
143 (if (empty? faults) nil faults)))
|
||||||
|
</span><br/>
|
||||||
|
<span class="blank" title="0 out of 0 forms covered">
|
||||||
|
144
|
||||||
|
</span><br/>
|
||||||
|
<span class="covered" title="1 out of 1 forms covered">
|
||||||
|
145 (defn persistent-object-faults
|
||||||
|
</span><br/>
|
||||||
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
|
146 "Return a list of faults found in persistent object `x`, or `nil` if none are."
|
||||||
|
</span><br/>
|
||||||
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
|
147 [x]
|
||||||
|
</span><br/>
|
||||||
|
<span class="covered" title="3 out of 3 forms covered">
|
||||||
|
148 (let [faults (concat
|
||||||
|
</span><br/>
|
||||||
|
<span class="covered" title="3 out of 3 forms covered">
|
||||||
|
149 (object-faults x)
|
||||||
|
</span><br/>
|
||||||
|
<span class="covered" title="3 out of 3 forms covered">
|
||||||
|
150 (remove empty?
|
||||||
|
</span><br/>
|
||||||
|
<span class="covered" title="2 out of 2 forms covered">
|
||||||
|
151 (list
|
||||||
|
</span><br/>
|
||||||
|
<span class="covered" title="5 out of 5 forms covered">
|
||||||
|
152 (if (contains? x :id)
|
||||||
|
</span><br/>
|
||||||
|
<span class="covered" title="6 out of 6 forms covered">
|
||||||
|
153 (try (let [id (URI. (:id x))]
|
||||||
|
</span><br/>
|
||||||
|
<span class="covered" title="6 out of 6 forms covered">
|
||||||
|
154 (when-not (= (.getScheme id) "https")
|
||||||
|
</span><br/>
|
||||||
|
<span class="covered" title="4 out of 4 forms covered">
|
||||||
|
155 (make-fault-object :should :id-not-https)))
|
||||||
|
</span><br/>
|
||||||
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
|
156 (catch URISyntaxException _
|
||||||
|
</span><br/>
|
||||||
|
<span class="covered" title="4 out of 4 forms covered">
|
||||||
|
157 (make-fault-object :must :id-not-uri))
|
||||||
|
</span><br/>
|
||||||
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
|
158 (catch NullPointerException _
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-covered" title="0 out of 4 forms covered">
|
<span class="not-covered" title="0 out of 4 forms covered">
|
||||||
104 (keyword "@context") validation-fault-context-uri
|
159 (make-fault-object :must :null-id-persistent)))
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-covered" title="0 out of 5 forms covered">
|
<span class="covered" title="4 out of 4 forms covered">
|
||||||
105 :id (str "https://"
|
160 (make-fault-object :must :no-id-persistent)))))]
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-covered" title="0 out of 2 forms covered">
|
<span class="covered" title="6 out of 6 forms covered">
|
||||||
106 (.. java.net.InetAddress getLocalHost getHostName)
|
161 (if (empty? faults) nil faults)))
|
||||||
</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><br/>
|
||||||
<span class="blank" title="0 out of 0 forms covered">
|
<span class="blank" title="0 out of 0 forms covered">
|
||||||
115
|
162
|
||||||
</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/>
|
</span><br/>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -268,7 +268,7 @@
|
||||||
<span class="blank" title="0 out of 0 forms covered">
|
<span class="blank" title="0 out of 0 forms covered">
|
||||||
088
|
088
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="partial" title="2 out of 4 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
089 ;; (actor-type? "Group")
|
089 ;; (actor-type? "Group")
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="blank" title="0 out of 0 forms covered">
|
<span class="blank" title="0 out of 0 forms covered">
|
||||||
|
@ -280,7 +280,7 @@
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
092 "The set of types we will accept as verbs.
|
092 "The set of types we will accept as verbs.
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="partial" title="2 out of 4 forms covered">
|
||||||
093
|
093
|
||||||
</span><br/>
|
</span><br/>
|
||||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||||
|
|
|
@ -94,21 +94,32 @@
|
||||||
<td class="with-number">35</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>
|
||||||
<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"
|
<td><a href="dog_and_duck/quack/fault_messages.clj.html">dog-and-duck.quack.fault-messages</a></td><td class="with-bar"><div class="covered"
|
||||||
style="width:49.779735682819386%;
|
style="width:100.0%;
|
||||||
float:left;"> 113 </div><div class="not-covered"
|
float:left;"> 19 </div></td>
|
||||||
style="width:50.220264317180614%;
|
<td class="with-number">100.00 %</td>
|
||||||
float:left;"> 114 </div></td>
|
|
||||||
<td class="with-number">49.78 %</td>
|
|
||||||
<td class="with-bar"><div class="covered"
|
<td class="with-bar"><div class="covered"
|
||||||
style="width:38.775510204081634%;
|
style="width:100.0%;
|
||||||
float:left;"> 19 </div><div class="partial"
|
float:left;"> 3 </div></td>
|
||||||
style="width:6.122448979591836%;
|
<td class="with-number">100.00 %</td>
|
||||||
float:left;"> 3 </div><div class="not-covered"
|
<td class="with-number">12</td><td class="with-number">1</td><td class="with-number">3</td>
|
||||||
style="width:55.10204081632653%;
|
</tr>
|
||||||
float:left;"> 27 </div></td>
|
<tr>
|
||||||
<td class="with-number">44.90 %</td>
|
<td><a href="dog_and_duck/quack/picky.clj.html">dog-and-duck.quack.picky</a></td><td class="with-bar"><div class="covered"
|
||||||
<td class="with-number">143</td><td class="with-number">11</td><td class="with-number">49</td>
|
style="width:94.01993355481727%;
|
||||||
|
float:left;"> 283 </div><div class="not-covered"
|
||||||
|
style="width:5.980066445182724%;
|
||||||
|
float:left;"> 18 </div></td>
|
||||||
|
<td class="with-number">94.02 %</td>
|
||||||
|
<td class="with-bar"><div class="covered"
|
||||||
|
style="width:92.3076923076923%;
|
||||||
|
float:left;"> 60 </div><div class="partial"
|
||||||
|
style="width:6.153846153846154%;
|
||||||
|
float:left;"> 4 </div><div class="not-covered"
|
||||||
|
style="width:1.5384615384615385%;
|
||||||
|
float:left;"> 1 </div></td>
|
||||||
|
<td class="with-number">98.46 %</td>
|
||||||
|
<td class="with-number">162</td><td class="with-number">11</td><td class="with-number">65</td>
|
||||||
</tr>
|
</tr>
|
||||||
<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"
|
<td><a href="dog_and_duck/quack/quack.clj.html">dog-and-duck.quack.quack</a></td><td class="with-bar"><div class="covered"
|
||||||
|
@ -187,9 +198,9 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td>Totals:</td>
|
<tr><td>Totals:</td>
|
||||||
<td class="with-bar"></td>
|
<td class="with-bar"></td>
|
||||||
<td class="with-number">53.33 %</td>
|
<td class="with-number">61.92 %</td>
|
||||||
<td class="with-bar"></td>
|
<td class="with-bar"></td>
|
||||||
<td class="with-number">58.24 %</td>
|
<td class="with-number">67.69 %</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</body>
|
</body>
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
3
docs/codox/dog-and-duck.quack.fault-messages.html
Normal file
3
docs/codox/dog-and-duck.quack.fault-messages.html
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
12
src/dog_and_duck/quack/fault_messages.clj
Normal file
12
src/dog_and_duck/quack/fault_messages.clj
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
(ns dog-and-duck.quack.fault-messages)
|
||||||
|
|
||||||
|
(def messages
|
||||||
|
"Actual fault messages to which fault codes resolve."
|
||||||
|
{:id-not-https "Publicly facing content SHOULD use HTTPS URIs"
|
||||||
|
:id-not-uri "identifiers must be publicly dereferencable URIs"
|
||||||
|
:no-context "Section 3 of the ActivityPub specification states Implementers SHOULD include the ActivityPub context in their object definitions`."
|
||||||
|
:no-id-persistent "Persistent objects MUST have unique global identifiers."
|
||||||
|
:no-id-transient "The ActivityPub specification allows objects without `id` fields only if they are intentionally transient; even so it is preferred that the object should have an explicit null id."
|
||||||
|
:null-id-persistent "Persistent objects MUST have non-null identifiers."
|
||||||
|
:no-type "The ActivityPub specification states that the `type` field is optional, but it is hard to process objects with no known type."
|
||||||
|
:not-an-object "ActivityStreams object must be JSON objects."})
|
|
@ -27,7 +27,9 @@
|
||||||
possible to serialise a fault report as a
|
possible to serialise a fault report as a
|
||||||
document which in its own right conforms to the
|
document which in its own right conforms to the
|
||||||
ActivityStreams spec."
|
ActivityStreams spec."
|
||||||
(:require [dog-and-duck.utils.process :refer [pid]]))
|
(:require [dog-and-duck.quack.fault-messages :refer [messages]]
|
||||||
|
[dog-and-duck.utils.process :refer [pid]])
|
||||||
|
(:import [java.net URI URISyntaxException]))
|
||||||
|
|
||||||
(def ^:const severity
|
(def ^:const severity
|
||||||
"Severity of faults found, as follows:
|
"Severity of faults found, as follows:
|
||||||
|
@ -93,15 +95,15 @@
|
||||||
[x]
|
[x]
|
||||||
`(context? ((keyword "@context") ~x)))
|
`(context? ((keyword "@context") ~x)))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(defn make-fault-object
|
(defn make-fault-object
|
||||||
"Return a fault object with these `severity`, `fault` and `narrative` values.
|
"Return a fault object with these `severity`, `fault` and `narrative` values.
|
||||||
|
|
||||||
An ActivityPub object MUST have a globally unique ID. Whether this is
|
An ActivityPub object MUST have a globally unique ID. Whether this is
|
||||||
meaningful depends on whether we persist fault report objects and serve
|
meaningful depends on whether we persist fault report objects and serve
|
||||||
them, which at present I have no plans to do."
|
them, which at present I have no plans to do."
|
||||||
[severity fault narrative]
|
;; TODO: should not pass in the narrative; instead should use the :fault value
|
||||||
|
;; to look up the narrative in a resource file.
|
||||||
|
[severity fault]
|
||||||
(assoc {}
|
(assoc {}
|
||||||
(keyword "@context") validation-fault-context-uri
|
(keyword "@context") validation-fault-context-uri
|
||||||
:id (str "https://"
|
:id (str "https://"
|
||||||
|
@ -113,33 +115,48 @@
|
||||||
:type "Fault"
|
:type "Fault"
|
||||||
:severity severity
|
:severity severity
|
||||||
:fault fault
|
:fault fault
|
||||||
:narrative narrative))
|
:narrative (messages fault)))
|
||||||
|
|
||||||
(defn object-faults
|
(defn object-faults
|
||||||
|
"Return a list of faults found in object `x`, or `nil` if none are."
|
||||||
[x]
|
[x]
|
||||||
(remove
|
(let [faults (remove
|
||||||
empty?
|
empty?
|
||||||
(list
|
(list
|
||||||
|
(when-not (map? x)
|
||||||
|
(make-fault-object
|
||||||
|
:critical
|
||||||
|
:not-an-object))
|
||||||
(when-not
|
(when-not
|
||||||
(has-context? x)
|
(has-context? x)
|
||||||
(make-fault-object
|
(make-fault-object
|
||||||
:should
|
:should
|
||||||
:no-context
|
:no-context))
|
||||||
"Section 3 of the ActivityPub specification states
|
|
||||||
`Implementers SHOULD include the ActivityPub context in
|
|
||||||
their object definitions`.")
|
|
||||||
(when-not (:type x)
|
(when-not (:type x)
|
||||||
(make-fault-object
|
(make-fault-object
|
||||||
:minor
|
:minor
|
||||||
:no-type
|
:no-type))
|
||||||
"The ActivityPub specification states that the `type` field is
|
(when-not (and (map? x) (contains? x :id))
|
||||||
optional, but it is hard to process objects with no known type."))
|
|
||||||
(when-not (contains? x :id)
|
|
||||||
(make-fault-object
|
(make-fault-object
|
||||||
:minor
|
:minor
|
||||||
:no-id-transient
|
:no-id-transient))))]
|
||||||
"The ActivityPub specification allows objects without `id` fields
|
(if (empty? faults) nil faults)))
|
||||||
only if they are intentionally transient; even so it is preferred
|
|
||||||
that the object should have an explicit null id."
|
(defn persistent-object-faults
|
||||||
))
|
"Return a list of faults found in persistent object `x`, or `nil` if none are."
|
||||||
))))
|
[x]
|
||||||
|
(let [faults (concat
|
||||||
|
(object-faults x)
|
||||||
|
(remove empty?
|
||||||
|
(list
|
||||||
|
(if (contains? x :id)
|
||||||
|
(try (let [id (URI. (:id x))]
|
||||||
|
(when-not (= (.getScheme id) "https")
|
||||||
|
(make-fault-object :should :id-not-https)))
|
||||||
|
(catch URISyntaxException _
|
||||||
|
(make-fault-object :must :id-not-uri))
|
||||||
|
(catch NullPointerException _
|
||||||
|
(make-fault-object :must :null-id-persistent)))
|
||||||
|
(make-fault-object :must :no-id-persistent)))))]
|
||||||
|
(if (empty? faults) nil faults)))
|
||||||
|
|
||||||
|
|
91
test/dog_and_duck/quack/picky_test.clj
Normal file
91
test/dog_and_duck/quack/picky_test.clj
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
(ns dog-and-duck.quack.picky-test
|
||||||
|
(:require [clojure.test :refer [deftest is testing]]
|
||||||
|
[dog-and-duck.quack.picky :refer [activitystreams-context-uri
|
||||||
|
filter-severity object-faults
|
||||||
|
persistent-object-faults]]))
|
||||||
|
|
||||||
|
(deftest object-fault-tests
|
||||||
|
(let [perfect {(keyword "@context") activitystreams-context-uri
|
||||||
|
:id "https://somewhere.out.there/object/14323:1671654380083"
|
||||||
|
:type "Test"}]
|
||||||
|
(testing "no faults returned from fully specified objects"
|
||||||
|
(let [actual (object-faults perfect)
|
||||||
|
expected nil]
|
||||||
|
(is (= actual expected) "There should be no faults from a perfect object"))
|
||||||
|
(let [o (assoc perfect :age 10 :name "Sally")
|
||||||
|
actual (object-faults o)
|
||||||
|
expected nil]
|
||||||
|
(is (= actual expected) "Adding additional fields should not cause faults")))
|
||||||
|
(testing "Faults returned from improperly specified objects"
|
||||||
|
(let [o "not an object"
|
||||||
|
r (object-faults o)]
|
||||||
|
(let [expected 4
|
||||||
|
actual (count r)]
|
||||||
|
(is (= actual expected) "Expect to see four faults from a non-object"))
|
||||||
|
(let [expected 1
|
||||||
|
actual (count (filter-severity r :must))]
|
||||||
|
(is (= actual expected) "Expect one :critical fault from a non-object"))
|
||||||
|
(let [expected :not-an-object
|
||||||
|
actual (:fault (first (filter-severity r :must)))]
|
||||||
|
(is (= actual expected) "Expect the one :critical fault to be :not-an-object")))
|
||||||
|
(let [o {}
|
||||||
|
r (object-faults o)]
|
||||||
|
(let [expected 3
|
||||||
|
actual (count r)]
|
||||||
|
(is (= actual expected) "Expect to see three faults from an empty object"))
|
||||||
|
(let [expected 0
|
||||||
|
actual (count (filter-severity r :must))]
|
||||||
|
(is (= actual expected) "Expect no :critical faults from an empty object"))
|
||||||
|
(let [expected :no-context
|
||||||
|
actual (:fault (first (filter-severity r :minor)))]
|
||||||
|
(is (= actual expected) "Expect the one non-:minor fault to be :no-context")))
|
||||||
|
(let [o (dissoc perfect (keyword "@context"))
|
||||||
|
r (object-faults o)
|
||||||
|
expected :no-context
|
||||||
|
actual (:fault (first (filter-severity r :all)))]
|
||||||
|
(is (= actual expected)
|
||||||
|
"Expect the one fault from an object with no context to be :no-context."))
|
||||||
|
(let [o (dissoc perfect :id)
|
||||||
|
r (object-faults o)
|
||||||
|
expected :no-id-transient
|
||||||
|
actual (:fault (first (filter-severity r :all)))]
|
||||||
|
(is (= actual expected)
|
||||||
|
"Expect the one fault from an object with no id to be :no-id-transient."))
|
||||||
|
(let [o (dissoc perfect :type)
|
||||||
|
r (object-faults o)
|
||||||
|
expected :no-type
|
||||||
|
actual (:fault (first (filter-severity r :all)))]
|
||||||
|
(is (= actual expected)
|
||||||
|
"Expect the one fault from an object with no type to be :no-type.")))))
|
||||||
|
|
||||||
|
(deftest peristent-object-fault-tests
|
||||||
|
(let [perfect {(keyword "@context") activitystreams-context-uri
|
||||||
|
:id "https://somewhere.out.there/object/14323:1671654380083"
|
||||||
|
:type "Test"}]
|
||||||
|
(testing "no faults returned from fully specified objects"
|
||||||
|
(let [actual (persistent-object-faults perfect)
|
||||||
|
expected nil]
|
||||||
|
(is (= actual expected) "There should be no faults from a perfect object"))
|
||||||
|
(let [o (assoc perfect :age 10 :name "Sally")
|
||||||
|
actual (persistent-object-faults o)
|
||||||
|
expected nil]
|
||||||
|
(is (= actual expected) "Adding additional fields should not cause faults")))
|
||||||
|
(testing "faults specific to persistent objects"
|
||||||
|
(let [o (dissoc perfect :id)
|
||||||
|
expected 1
|
||||||
|
actual (count
|
||||||
|
(filter
|
||||||
|
#(= (:fault %) :no-id-persistent)
|
||||||
|
(persistent-object-faults o)))]
|
||||||
|
(is (= actual expected)
|
||||||
|
"The fault from a persistent object with no id should be :no-id-persistent"))
|
||||||
|
(let [o (assoc perfect :id "http://somewhere.out.there/object/14323:1671654380083")
|
||||||
|
expected :id-not-https
|
||||||
|
actual (-> o persistent-object-faults first :fault)]
|
||||||
|
(is (= actual expected)
|
||||||
|
"The fault from a persistent object with an HTTP id should be :id-not-https"))
|
||||||
|
(let [o (assoc perfect :id "not a valid URI")
|
||||||
|
expected :id-not-uri
|
||||||
|
actual (-> o persistent-object-faults first :fault)]
|
||||||
|
(is (= actual expected)
|
||||||
|
"The fault from a persistent object with an id which is not a valid URI should be :id-not-uri")))))
|
Loading…
Reference in a new issue