Snakecaseify keys

This commit is contained in:
vrde 2017-04-13 08:54:34 +02:00
parent 303e12ee28
commit 414d915033
No known key found for this signature in database
GPG Key ID: 6581C7C39B3D397D
3 changed files with 10 additions and 10 deletions

View File

@ -109,9 +109,9 @@ class Dispatcher:
for tx in block['block']['transactions']: for tx in block['block']['transactions']:
asset_id = tx['id'] if tx['operation'] == 'CREATE' else tx['asset']['id'] asset_id = tx['id'] if tx['operation'] == 'CREATE' else tx['asset']['id']
data = {'blockid': block['id'], data = {'block_id': block['id'],
'assetid': asset_id, 'asset_id': asset_id,
'txid': tx['id']} 'tx_id': tx['id']}
str_buffer.append(json.dumps(data)) str_buffer.append(json.dumps(data))
for _, websocket in self.subscribers.items(): for _, websocket in self.subscribers.items():

View File

@ -82,9 +82,9 @@ the transaction's ID, associated asset ID, and containing block's ID.
Example message:: Example message::
{ {
"txid": "<sha3-256 hash>", "tx_id": "<sha3-256 hash>",
"assetid": "<sha3-256 hash>", "asset_id": "<sha3-256 hash>",
"blockid": "<sha3-256 hash>" "block_id": "<sha3-256 hash>"
} }

View File

@ -183,10 +183,10 @@ def test_websocket_block_event(b, _block, test_client, loop):
for tx in block['block']['transactions']: for tx in block['block']['transactions']:
result = yield from ws.receive() result = yield from ws.receive()
json_result = json.loads(result.data) json_result = json.loads(result.data)
assert json_result['txid'] == tx['id'] assert json_result['tx_id'] == tx['id']
# Since the transactions are all CREATEs, asset id == transaction id # Since the transactions are all CREATEs, asset id == transaction id
assert json_result['assetid'] == tx['id'] assert json_result['asset_id'] == tx['id']
assert json_result['blockid'] == block['id'] assert json_result['block_id'] == block['id']
yield from event_source.put(POISON_PILL) yield from event_source.put(POISON_PILL)
@ -235,4 +235,4 @@ def test_integration_from_webapi_to_websocket(monkeypatch, client, loop):
result = loop.run_until_complete(ws.receive()) result = loop.run_until_complete(ws.receive())
json_result = json.loads(result.data) json_result = json.loads(result.data)
assert json_result['txid'] == tx.id assert json_result['tx_id'] == tx.id