Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rsoeldner committed May 16, 2024
1 parent f53564e commit 5d37017
Show file tree
Hide file tree
Showing 11 changed files with 78 additions and 66 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "pact-tests/pact-tests/marmalade"]
path = pact-tests/pact-tests/marmalade
url = git@github.com:kadena-io/marmalade.git
22 changes: 11 additions & 11 deletions pact-tests/legacy-serial-tests/coin-v5/coin-v5.repl
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@
; w/o capability
(expect-failure
"direct call to credit fails"
"cap not in scope"
"require-capability: not granted: "
(credit 'emily (read-keyset 'emily) 1.0))

(expect-failure
"direct call to debit fails"
"cap not in scope"
"require-capability: not granted: "
(debit 'emily 1.0))

(env-gas 0) (env-gaslog)
Expand Down Expand Up @@ -229,22 +229,22 @@

(expect-failure
"fund-tx should fail when GAS is not in scope"
"cap not in scope coin.GAS"
"require-capability: not granted: (coin.GAS)"
(fund-tx 'emily 'doug (read-keyset 'doug) 1.0))

(test-capability (GAS))
(env-keys [])

(expect-failure
"fund-tx fails without signature"
"Keyset enforce failure"
"Keyset failure"
(fund-tx 'emily 'doug (read-keyset 'doug) 1.0))

(env-sigs [{"key": "keys1", "caps": [(TRANSFER "emily" "doug" 1.0)]}])

(expect-failure
"fund-tx fails for no gas cap"
"Keyset enforce failure"
"Keyset failure"
(fund-tx 'emily 'doug (read-keyset 'doug) 1.0))

(expect-failure
Expand Down Expand Up @@ -457,7 +457,7 @@

(expect-failure
"coinbase fails when capability is not in scope"
"cap not in scope coin.COINBASE"
"require-capability: not granted: (coin.COINBASE)"
(coinbase 'emily (read-keyset 'emily) 0.0))

(test-capability (COINBASE))
Expand Down Expand Up @@ -515,7 +515,7 @@

(expect-failure
"cross-chain transfers fail wrong key"
"Keyset enforce failure"
"Keyset failure"
(transfer-crosschain 'emily 'doug (read-keyset 'doug) "1" 1.0))

(env-sigs [{ 'key: "keys1", 'caps: [(coin.TRANSFER_XCHAIN 'emily 'doug 1.0 "1")]}])
Expand Down Expand Up @@ -738,7 +738,7 @@

(expect-failure
"allocation account creation only occurs at genesis"
"cap not in scope coin.GENESIS"
"require-capability: not granted: (coin.GENESIS)"
(create-allocation-account "brandon" (time "1900-10-31T00:00:00Z") "brandon" 200000.0))

(test-capability (GENESIS))
Expand Down Expand Up @@ -795,7 +795,7 @@

(expect-failure
"allocation release fails when keys are not in scope"
"Keyset enforce failure"
"Keyset failure"
(release-allocation "brandon"))

(env-keys ["brandon"])
Expand All @@ -822,7 +822,7 @@

(expect-failure
"gas-only fails without the presence of GAS"
"cap not in scope coin.GAS"
"require-capability: not granted: (coin.GAS)"
(gas-only))

(expect-failure
Expand Down Expand Up @@ -865,7 +865,7 @@

(expect-failure
"Remediations fail without the presence of REMEDIATE"
"cap not in scope"
"require-capability: not granted: "
(remediate "brandon" 1.0))

(test-capability (REMEDIATE))
Expand Down
6 changes: 3 additions & 3 deletions pact-tests/pact-tests/caps.repl
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@
(install-capability (C "alice" 0 true))
(expect-failure
"Autonomous install on unscoped user sig cannot acquire"
"Keyset enforce failure"
"Keyset failure"
(go "alice" 0))

;; scenario: autonomous install, but fails anyway because call is not from module.
Expand All @@ -552,7 +552,7 @@
(install-capability (C "bob" 1 true))
(expect-failure
"Attack with different parameters than signature cap fails"
"Keyset enforce failure"
"Keyset failure"
(go "bob" 1))

(commit-tx)
Expand Down Expand Up @@ -584,7 +584,7 @@
;; scenario: alice signs caps, only works in non-managed cap
(env-sigs [{ "key": "alice", "caps": [(GUARD "alice-keyset")]}])
(expect "cap-scoped works with cap" true (enforce-cap "alice-keyset"))
(expect-failure "cap-scoped does not work without cap" "Keyset enforce failure"
(expect-failure "cap-scoped does not work without cap" "Keyset failure"
(enforce-wo-cap "alice-keyset"))


Expand Down
18 changes: 9 additions & 9 deletions pact-tests/pact-tests/coin-v1.repl
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@
; w/o capability
(expect-failure
"direct call to credit fails"
"cap not in scope"
"require-capability: not granted: (coin.CREDIT)"
(credit 'emily (read-keyset 'emily) 1.0))

(expect-failure
"direct call to debit fails"
"cap not in scope"
"require-capability: not granted: (coin.DEBIT)"
(debit 'emily 1.0))

(env-gas 0) (env-gaslog)
Expand Down Expand Up @@ -230,22 +230,22 @@

(expect-failure
"fund-tx should fail when GAS is not in scope"
"cap not in scope coin.GAS"
"require-capability: not granted: (coin.GAS)"
(fund-tx 'emily 'doug (read-keyset 'doug) 1.0))

(test-capability (GAS))
(env-keys [])

(expect-failure
"fund-tx fails without signature"
"Keyset enforce failure"
"Keyset failure"
(fund-tx 'emily 'doug (read-keyset 'doug) 1.0))

(env-sigs [{"key": "keys1", "caps": [(TRANSFER "emily" "doug" 1.0)]}])

(expect-failure
"fund-tx fails for no gas cap"
"Keyset enforce failure"
"Keyset failure"
(fund-tx 'emily 'doug (read-keyset 'doug) 1.0))

(expect-failure
Expand Down Expand Up @@ -458,7 +458,7 @@

(expect-failure
"coinbase fails when capability is not in scope"
"cap not in scope"
"require-capability: not granted: (coin.COINBASE)"
(coinbase 'emily (read-keyset 'emily) 0.0))

(test-capability (COINBASE))
Expand Down Expand Up @@ -696,7 +696,7 @@

(expect-failure
"allocation account creation only occurs at genesis"
"cap not in scope coin.GENESIS"
"require-capability: not granted: (coin.GENESIS)"
(create-allocation-account "brandon" (time "1900-10-31T00:00:00Z") "brandon" 200000.0))
(test-capability (GENESIS))

Expand Down Expand Up @@ -751,7 +751,7 @@

(expect-failure
"allocation release fails when keys are not in scope"
"Keyset enforce failure"
"Keyset failure"
(release-allocation "brandon"))

(env-keys ["brandon"])
Expand All @@ -778,7 +778,7 @@

(expect-failure
"gas-only fails without the presence of GAS"
"cap not in scope coin.GAS"
"require-capability: not granted: (coin.GAS)"
(gas-only))

(expect-failure
Expand Down
22 changes: 11 additions & 11 deletions pact-tests/pact-tests/coin-v5.repl
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,12 @@
; w/o capability
(expect-failure
"direct call to credit fails"
"cap not in scope"
"require-capability: not granted: "
(credit 'emily (read-keyset 'emily) 1.0))

(expect-failure
"direct call to debit fails"
"cap not in scope"
"require-capability: not granted: "
(debit 'emily 1.0))

(env-gas 0) (env-gaslog)
Expand Down Expand Up @@ -242,22 +242,22 @@

(expect-failure
"fund-tx should fail when GAS is not in scope"
"cap not in scope coin.GAS"
"require-capability: not granted: (coin.GAS)"
(fund-tx 'emily 'doug (read-keyset 'doug) 1.0))

(test-capability (GAS))
(env-keys [])

(expect-failure
"fund-tx fails without signature"
"Keyset enforce failure"
"Keyset failure"
(fund-tx 'emily 'doug (read-keyset 'doug) 1.0))

(env-sigs [{"key": "keys1", "caps": [(TRANSFER "emily" "doug" 1.0)]}])

(expect-failure
"fund-tx fails for no gas cap"
"Keyset enforce failure"
"Keyset failure"
(fund-tx 'emily 'doug (read-keyset 'doug) 1.0))

(expect-failure
Expand Down Expand Up @@ -470,7 +470,7 @@

(expect-failure
"coinbase fails when capability is not in scope"
"cap not in scope coin.COINBASE"
"require-capability: not granted: (coin.COINBASE)"
(coinbase 'emily (read-keyset 'emily) 0.0))

(test-capability (COINBASE))
Expand Down Expand Up @@ -528,7 +528,7 @@

(expect-failure
"cross-chain transfers fail wrong key"
"Keyset enforce failure"
"Keyset failure"
(transfer-crosschain 'emily 'doug (read-keyset 'doug) "1" 1.0))

(env-sigs [{ 'key: "keys1", 'caps: [(coin.TRANSFER_XCHAIN 'emily 'doug 1.0 "1")]}])
Expand Down Expand Up @@ -751,7 +751,7 @@

(expect-failure
"allocation account creation only occurs at genesis"
"cap not in scope coin.GENESIS"
"require-capability: not granted: (coin.GENESIS)"
(create-allocation-account "brandon" (time "1900-10-31T00:00:00Z") "brandon" 200000.0))

(test-capability (GENESIS))
Expand Down Expand Up @@ -808,7 +808,7 @@

(expect-failure
"allocation release fails when keys are not in scope"
"Keyset enforce failure"
"Keyset failure"
(release-allocation "brandon"))

(env-keys ["brandon"])
Expand All @@ -835,7 +835,7 @@

(expect-failure
"gas-only fails without the presence of GAS"
"cap not in scope coin.GAS"
"require-capability: not granted: (coin.GAS)"
(gas-only))

(expect-failure
Expand Down Expand Up @@ -878,7 +878,7 @@

(expect-failure
"Remediations fail without the presence of REMEDIATE"
"cap not in scope"
"require-capability: not granted: "
(remediate "brandon" 1.0))

(test-capability (REMEDIATE))
Expand Down
34 changes: 17 additions & 17 deletions pact-tests/pact-tests/db.repl
Original file line number Diff line number Diff line change
Expand Up @@ -82,43 +82,43 @@
(begin-tx)
(use dbtest)
(expect-failure
"write protected by admin key" "Keyset enforce failure"
"write protected by admin key" "Keyset failure"
(write persons "foo" ROW_A))
(expect-failure
"update protected by admin key" "Keyset enforce failure"
"update protected by admin key" "Keyset failure"
(update persons "foo" ROW_A))
(expect-failure
"insert protected by admin key" "Keyset enforce failure"
"insert protected by admin key" "Keyset failure"
(insert persons "foo" ROW_A))
(expect-failure
"keys protected by admin key" "Keyset enforce failure"
"keys protected by admin key" "Keyset failure"
(keys persons))
(expect-failure
"txids protected by admin key" "Keyset enforce failure"
"txids protected by admin key" "Keyset failure"
(txids persons 0))
(expect-failure
"txlog protected by admin key" "Keyset enforce failure"
"txlog protected by admin key" "Keyset failure"
(txlog persons 2))
(expect-failure
"keylogs protected by admin key" "Keyset enforce failure"
"keylogs protected by admin key" "Keyset failure"
(keylog persons "" 2))
(expect-failure
"read protected by admin key" "Keyset enforce failure"
"read protected by admin key" "Keyset failure"
(read persons ID_A))
(expect-failure
"with-read protected by admin key" "Keyset enforce failure"
"with-read protected by admin key" "Keyset failure"
(with-read persons ID_A { 'name:= name } name))
(expect-failure
"with-default-read protected by admin key" "Keyset enforce failure"
"with-default-read protected by admin key" "Keyset failure"
(with-default-read persons ID_A { 'name: "stu" } { 'name:= name } name))
(expect-failure
"select protected by admin key" "Keyset enforce failure"
"select protected by admin key" "Keyset failure"
(select persons (constantly true)))
(expect-failure
"keys protected by admin key" "Keyset enforce failure"
"keys protected by admin key" "Keyset failure"
(keys persons))
(expect-failure
"create-table protected by admin key" "Keyset enforce failure"
"create-table protected by admin key" "Keyset failure"
(create-table persons2))

;; just making sure this doesn't blow up, output is still TBD on better Term output in general
Expand All @@ -129,13 +129,13 @@
(env-exec-config ["AllowReadInLocal"])
(use dbtest)
(expect-failure
"write protected by admin key in local" "Keyset enforce failure"
"write protected by admin key in local" "Keyset failure"
(write persons "foo" ROW_A))
(expect-failure
"update protected by admin key in local" "Keyset enforce failure"
"update protected by admin key in local" "Keyset failure"
(update persons "foo" ROW_A))
(expect-failure
"insert protected by admin key in local" "Keyset enforce failure"
"insert protected by admin key in local" "Keyset failure"
(insert persons "foo" ROW_A))
(expect
"keys allowed in local" [ID_A]
Expand Down Expand Up @@ -165,7 +165,7 @@
"keys allowed in local" [ID_A]
(keys persons))
(expect-failure
"create-table protected by admin key in local" "Keyset enforce failure"
"create-table protected by admin key in local" "Keyset failure"
(create-table persons2))

;; test nested commits
Expand Down
1 change: 1 addition & 0 deletions pact-tests/pact-tests/marmalade
Submodule marmalade added at b6c1c2

0 comments on commit 5d37017

Please sign in to comment.