def test_event_create(self): op = operations.Event_create( **{ "fee": { "amount": 0, "asset_id": "1.3.0" }, "season": [["en", "2016-17"]], "start_time": "2017-03-29T09:15:05", "event_group_id": "1.0.1241", "competitors": ["0.0.0", "0.0.1"], "prefix": prefix, }) ops = [Operation(op)] tx = Signed_Transaction(ref_block_num=ref_block_num, ref_block_prefix=ref_block_prefix, expiration=expiration, operations=ops) tx = tx.sign([wif], chain=prefix) tx.verify([PrivateKey(wif).pubkey], prefix) txWire = hexlify(bytes(tx)).decode("ascii") compare = ("f68585abf4dce7c8045701300000000000000000000001026" "56e07323031362d313701197bdb58d9040000000000010200" "0000000000000001000000000000000000011f2f6eccc426e" "56925b29293610505598a8580dc56fc594fef541d25a7cfc8" "120d7b82dc6fb929bd6bb1fb8f2ab976559ea29c9adc7a9b5" "df9788b909c7fafe232") self.assertEqual(compare[:-130], txWire[:-130])
def test_event_create(self): self.op = operations.Event_create( **{ "fee": { "amount": 0, "asset_id": "1.3.0" }, "name": [["en", "My Event name"]], "season": [["en", "2016-17"]], "start_time": "2017-03-29T09:15:05", "event_group_id": "1.0.1241", "prefix": prefix, }) self.cm = ("f68585abf4dce7c8045701330000000000000000000102656" "e0d4d79204576656e74206e616d650102656e07323031362d" "313701197bdb58d9040000000000010000011f22c306e6b51" "0a66a1f1bf1acb537360a5d2d0f7b788f9da359b451ffc676" "54cb594144f23476c71d6caeb94162237de346abc485d1096" "86d17a55e9e9992439a") self.doit()
def event_create(self, season, start_time, competitors, event_group_id="0.0.0", account=None): """ Create an event. This needs to be **proposed**. :param list season: Internationalized names, e.g. ``[['de', 'Foo'], ['en', 'bar']]`` :param list competitors: List of (*relative*) ids of the competitors :param str event_group_id: Event group ID to create the competitors for (defaults to *relative* id ``0.0.0``) :param datetime start_time: Time of the start of the event :param str account: (optional) the account to allow access to (defaults to ``default_account``) """ assert self.proposer, "'event_create' needs to be proposed" assert isinstance(season, list) assert isinstance(competitors, list) assert isinstance( start_time, datetime), "start_time needs to be a `datetime.datetime`" if not account: if "default_account" in config: account = config["default_account"] if not account: raise ValueError("You need to provide an account") account = Account(account) op = operations.Event_create( **{ "fee": { "amount": 0, "asset_id": "1.3.0" }, "season": season, "start_time": formatTime(start_time), "event_group_id": event_group_id, "competitors": competitors, "prefix": self.rpc.chain_params["prefix"] }) return self.finalizeOp(op, account["name"], "active")