Skip to content

Commit

Permalink
PLT-7684 Web integration test for open roles.
Browse files Browse the repository at this point in the history
  • Loading branch information
bwbush committed Oct 30, 2023
1 parent fa29d55 commit dbac6ec
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ createCloseContract Wallet{..} = do
{ metadata = mempty
, version = Web.V1
, roles = Nothing
, threadTokenName = Nothing
, contract = ContractOrSourceId $ Left V1.Close
, minUTxODeposit = Nothing
, tags = mempty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,20 @@ import Test.Integration.Marlowe.Local (withLocalMarloweRuntime)

spec :: Spec
spec = describe "Valid POST /contracts" do
it "returns the contract header" $ withLocalMarloweRuntime $ runIntegrationTest do
it "returns the contract header"
. specWithRolesConfig
$ Web.Mint . Map.singleton "PartyA" . Web.RoleTokenSimple
it "returns the contract header (open roles)"
. specWithRolesConfig
. const . Web.Mint $ Map.fromList
[
("Thread", Web.ThreadRoleTokenSimple)
, ("PartyA", Web.OpenRoleTokenSimple)
]

specWithRolesConfig :: (Web.Address -> Web.RolesConfig) -> IO ()
specWithRolesConfig roles =
withLocalMarloweRuntime $ runIntegrationTest do
partyAWallet <- getGenesisWallet 0
partyBWallet <- getGenesisWallet 1

Expand All @@ -45,8 +58,7 @@ spec = describe "Valid POST /contracts" do
Web.PostContractsRequest
{ metadata = mempty
, version = Web.V1
, roles = Just $ Web.Mint $ Map.singleton "PartyA" $ Web.RoleTokenSimple partyAWebChangeAddress
, threadTokenName = Nothing
, roles = Just $ roles partyAWebChangeAddress
, contract = ContractOrSourceId $ Left contract
, minUTxODeposit = Nothing
, tags = mempty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ spec = describe "POST /contracts/{contractId}/transactions" do
{ metadata = mempty
, version = Web.V1
, roles = Just $ Web.Mint $ Map.singleton "PartyA" $ RoleTokenSimple partyAWebChangeAddress
, threadTokenName = Nothing
, contract = ContractOrSourceId $ Left contract
, minUTxODeposit = Nothing
, tags = mempty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ spec = describe "POST /contracts/{contractId}/transactions" do
{ metadata = mempty
, version = Web.V1
, roles = Just $ Web.Mint $ Map.singleton "Party A" $ RoleTokenSimple partyAWebChangeAddress
, threadTokenName = Nothing
, contract = ContractOrSourceId $ Left contract
, minUTxODeposit = Nothing
, tags = mempty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ spec = describe "PUT /contracts/{contractId}/transactions/{transaction}" do
{ metadata = mempty
, version = Web.V1
, roles = Just $ Web.Mint $ Map.singleton "Party A" $ RoleTokenSimple partyAWebChangeAddress
, threadTokenName = Nothing
, contract = ContractOrSourceId $ Left contract
, minUTxODeposit = Nothing
, tags = mempty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ createStandardContractWithTags tags partyAWallet partyBWallet = do
{ metadata = mempty
, version = Web.V1
, roles = Just $ Web.Mint $ Map.singleton "Party A" $ RoleTokenSimple partyAWebChangeAddress
, threadTokenName = Nothing
, contract = ContractOrSourceId $ Right contractSourceId
, minUTxODeposit = Nothing
, tags = tags
Expand Down
1 change: 0 additions & 1 deletion marlowe-integration/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ main = withLocalMarloweRuntime \MarloweRuntime{..} -> do
, tags = mempty
, version = Web.V1
, roles = Nothing
, threadTokenName = Nothing
, contract = ContractOrSourceId $ Left V1.Close
, minUTxODeposit = Nothing
}
Expand Down
3 changes: 0 additions & 3 deletions marlowe-runtime-web/.golden/OpenApi/golden
Original file line number Diff line number Diff line change
Expand Up @@ -1974,9 +1974,6 @@
},
"type": "object"
},
"threadTokenName": {
"type": "string"
},
"version": {
"$ref": "#/components/schemas/MarloweVersion"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,6 @@ data PostContractsRequest = PostContractsRequest
, metadata :: Map Word64 Metadata
, version :: MarloweVersion
, roles :: Maybe RolesConfig
, threadTokenName :: Maybe String
, contract :: ContractOrSourceId
, minUTxODeposit :: Maybe Word64
}
Expand Down
1 change: 0 additions & 1 deletion marlowe-runtime-web/test/Spec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ instance Arbitrary Web.PostContractsRequest where
<*> arbitrary
<*> arbitrary
<*> arbitrary
<*> arbitrary
-- size of 6 will result in a 1-layer deep contract being generated (this is
-- all we care about for the purposes of schema checking).
<*> arbitrary
Expand Down

0 comments on commit dbac6ec

Please sign in to comment.