def test_object_atomic_default_false(self): builder = CommandBuilder(atomic_default=False) 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, ledger_effective_time=DEFAULT_NOW, maximum_record_time=DEFAULT_MRT, commands=[CreateCommand(UnresolvedTypeReference('Sample.Untyped'), dict(arg=1))]), 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, ledger_effective_time=DEFAULT_NOW, maximum_record_time=DEFAULT_MRT, commands=[ExerciseCommand(SOME_CONTRACT_ID, "SomeChoice", {"choiceArg": "value"})]) ] actual = builder.build(DEFAULTS, DEFAULT_NOW) self.assertEqual(expected, actual)
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(UnresolvedTypeReference('Sample.Untyped'), dict(arg=1))] )] actual = builder.build(DEFAULTS) assert expected == actual
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, ledger_effective_time=DEFAULT_NOW, maximum_record_time=DEFAULT_MRT, commands=[CreateCommand(UnresolvedTypeReference('Sample.Untyped'), dict(arg=1))] )] actual = builder.build(DEFAULTS, DEFAULT_NOW) self.assertEqual(expected, actual)
def test_object_atomic_default_true(self): 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(UnresolvedTypeReference('Sample.Untyped'), dict(arg=1)), ExerciseCommand(SOME_CONTRACT_ID, "SomeChoice", {"choiceArg": "value"}) ] )] actual = builder.build(DEFAULTS) assert expected == actual