def test_object_create_untyped(self): builder = CommandBuilder() builder.create("Sample:Untyped", {"arg": 1}) expected = [ CommandPayload( party=SOME_PARTY, ledger_id=DEFAULTS.default_ledger_id, workflow_id=DEFAULTS.default_workflow_id, application_id=DEFAULTS.default_application_id, command_id=DEFAULTS.default_command_id, commands=[CreateCommand(SOME_TEMPLATE_NAME, dict(arg=1))], ) ] actual = builder.build(DEFAULTS) assert expected == actual
def test_object_atomic_default_true(self): with pytest.warns(DeprecationWarning): builder = CommandBuilder(atomic_default=True) builder.create("Sample:Untyped", {"arg": 1}) builder.exercise(SOME_CONTRACT_ID, "SomeChoice", {"choiceArg": "value"}) expected = [ CommandPayload( party=SOME_PARTY, ledger_id=DEFAULTS.default_ledger_id, workflow_id=DEFAULTS.default_workflow_id, application_id=DEFAULTS.default_application_id, command_id=DEFAULTS.default_command_id, commands=[ CreateCommand(SOME_TEMPLATE_NAME, dict(arg=1)), ExerciseCommand(SOME_CONTRACT_ID, "SomeChoice", {"choiceArg": "value"}), ], ) ] actual = builder.build(DEFAULTS) assert expected == actual
def test_single_create_untyped(self): with pytest.warns(DeprecationWarning): expr = create("Sample:Untyped", {"arg": 1}) expected = [ CommandPayload( party=SOME_PARTY, ledger_id=DEFAULTS.default_ledger_id, workflow_id=DEFAULTS.default_workflow_id, application_id=DEFAULTS.default_application_id, command_id=DEFAULTS.default_command_id, commands=[CreateCommand(SOME_TEMPLATE_NAME, dict(arg=1))], ) ] with pytest.warns(DeprecationWarning): actual = CommandBuilder.coerce(expr).build(DEFAULTS) assert expected == actual