-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
replace more reaction test constants
- Loading branch information
Showing
3 changed files
with
22 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1032,21 +1032,6 @@ | |
;; Statement Reaction Tests | ||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
|
||
(def invalid-template-invalid-path | ||
{"actor" {"mbox" {"$templatePath" ["x" "actor" "mbox"]}} | ||
"verb" {"id" "https://example.com/verbs/completed"} | ||
"object" {"id" "https://example.com/activities/a-and-b" | ||
"objectType" "Activity"}}) | ||
|
||
(def reaction-statement-result | ||
{"actor" {"mbox" "mailto:[email protected]"}, | ||
"verb" {"id" "https://example.com/verbs/completed"}, | ||
"object" | ||
{"id" "https://example.com/activities/a-and-b", | ||
"objectType" "Activity"} | ||
"context" | ||
{"extensions" {"https://example.com/foo" nil}}}) | ||
|
||
(defn- remove-id | ||
[statement] | ||
(dissoc statement "id")) | ||
|
@@ -1066,7 +1051,7 @@ | |
(assoc | ||
tc/simple-reaction-ruleset | ||
:template | ||
invalid-template-invalid-path) | ||
tc/invalid-template-invalid-path) | ||
{bad-reaction-id | ||
:result} (adp/-create-reaction | ||
lrs "reaction-bad" bad-ruleset true)] | ||
|
@@ -1080,7 +1065,7 @@ | |
(testing "New statement added" | ||
(is (= {:statement-result | ||
{:statements | ||
[reaction-statement-result | ||
[tc/reaction-stmt-result | ||
(remove-id tc/reaction-stmt-b) | ||
(remove-id tc/reaction-stmt-a)] | ||
:more ""} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,12 +78,7 @@ | |
[{:reaction-id reaction-id | ||
:trigger-id trigger-id | ||
:statement | ||
{"actor" {"mbox" "mailto:[email protected]"}, | ||
"verb" {"id" "https://example.com/verbs/completed"}, | ||
"object" | ||
{"id" "https://example.com/activities/a-and-b", | ||
"objectType" "Activity"} | ||
"context" {"extensions" {"https://example.com/foo" nil}}} | ||
tc/reaction-stmt-result | ||
;; Authority derived from the trigger statement | ||
:authority (:agent tc/auth-ident)}]} | ||
(qr/query-statement-reactions | ||
|
@@ -119,13 +114,9 @@ | |
[{:reaction-id reaction-id | ||
:trigger-id trigger-id | ||
:statement | ||
{"actor" {"mbox" "mailto:[email protected]"}, | ||
"verb" {"id" "https://example.com/verbs/completed"}, | ||
"object" | ||
{"id" "https://example.com/activities/a-and-b", | ||
"objectType" "Activity"} | ||
"context" {"extensions" {"https://example.com/foo" nil}} | ||
"authority" {"mbox" "mailto:[email protected]"}} | ||
(merge | ||
tc/reaction-stmt-result | ||
{"authority" {"mbox" "mailto:[email protected]"}}) | ||
;; Authority derived from the template | ||
:authority {"mbox" "mailto:[email protected]"}}]} | ||
(qr/query-statement-reactions | ||
|
@@ -149,12 +140,7 @@ | |
"reaction-bad-template" | ||
(merge | ||
tc/simple-reaction-ruleset | ||
{:template | ||
;; Template with invalid path | ||
{"actor" {"mbox" {"$templatePath" ["x" "actor" "mbox"]}} | ||
"verb" {"id" "https://example.com/verbs/completed"} | ||
"object" {"id" "https://example.com/activities/a-and-b" | ||
"objectType" "Activity"}}}) | ||
{:template tc/invalid-template-invalid-path}) | ||
true)] | ||
(try | ||
;; Add statements | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,3 +85,18 @@ | |
"context" {"extensions" | ||
{"https://example.com/array" ["foo" "bar" "baz"] | ||
"https://example.com/number" 200}}}) | ||
|
||
(def reaction-stmt-result | ||
{"actor" {"mbox" "mailto:[email protected]"}, | ||
"verb" {"id" "https://example.com/verbs/completed"}, | ||
"object" | ||
{"id" "https://example.com/activities/a-and-b", | ||
"objectType" "Activity"} | ||
"context" | ||
{"extensions" {"https://example.com/foo" nil}}}) | ||
|
||
(def invalid-template-invalid-path | ||
{"actor" {"mbox" {"$templatePath" ["x" "actor" "mbox"]}} | ||
"verb" {"id" "https://example.com/verbs/completed"} | ||
"object" {"id" "https://example.com/activities/a-and-b" | ||
"objectType" "Activity"}}) |