Commit 61e76da6 authored by Pavel Kuzmenko's avatar Pavel Kuzmenko
Browse files

Merge branch 'zamirets/52/add-more-logs' into 'master'

Add more logs during operations

See merge request !184
parents c2194aac 626064ea
......@@ -98,6 +98,7 @@ class SocketMirrorClientSimpleProtocol(BaseSocketMirrorClient):
return response_data['data']
async def upsert(self, ts, data):
LOG.info(f"Upsert operation for object id: {data['_id']}, timestamp: {ts}")
await self.ws.send_json({
'type': 'upsert',
'data': data,
......@@ -141,6 +142,7 @@ class SocketMirrorClientFullProtocol(SocketMirrorClientSimpleProtocol):
"""
async def update(self, ts, data):
LOG.info(f"Update operation for object id: {data['_id']}, timestamp: {ts}")
await self.ws.send_json({
'type': 'update',
'data': data,
......@@ -148,6 +150,7 @@ class SocketMirrorClientFullProtocol(SocketMirrorClientSimpleProtocol):
}, dumps=ujson.dumps)
async def delete(self, ts, data):
LOG.info(f"Delete operation for object id: {data['_id']}, timestamp: {ts}")
await self.ws.send_json({
'type': 'delete',
'data': data,
......
......@@ -110,10 +110,10 @@ class TestSocketMirrorClientSimpleProtocol:
test_ws.send_json = AsyncMock()
test_client = SocketMirrorClientSimpleProtocol(ws=test_ws, namespace='test')
ts = timestamp.Timestamp(12345, 1)
await test_client.upsert(ts=ts, data={'msg': 'test'})
await test_client.upsert(ts=ts, data={'msg': 'test', '_id': '61cb302a8bf859b605514445'})
test_ws.send_json.assert_called_once_with({
'type': 'upsert',
'data': {'msg': 'test'},
'data': {'msg': 'test', '_id': '61cb302a8bf859b605514445'},
'ts': ts
}, dumps=ujson.dumps)
......@@ -137,10 +137,10 @@ class TestSocketMirrorClientFullProtocol:
test_ws.send_json = AsyncMock()
test_client = SocketMirrorClientFullProtocol(ws=test_ws, namespace='test')
ts = timestamp.Timestamp(12345, 1)
await test_client.update(ts=ts, data={'msg': 'test'})
await test_client.update(ts=ts, data={'msg': 'test', '_id': '61cb302a8bf859b605514445'})
test_ws.send_json.assert_called_once_with({
'type': 'update',
'data': {'msg': 'test'},
'data': {'msg': 'test', '_id': '61cb302a8bf859b605514445'},
'ts': ts
}, dumps=ujson.dumps)
......@@ -149,10 +149,10 @@ class TestSocketMirrorClientFullProtocol:
test_ws.send_json = AsyncMock()
test_client = SocketMirrorClientFullProtocol(ws=test_ws, namespace='test')
ts = timestamp.Timestamp(12345, 1)
await test_client.delete(ts=ts, data={'msg': 'test'})
await test_client.delete(ts=ts, data={'msg': 'test', '_id': '61cb302a8bf859b605514445'})
test_ws.send_json.assert_called_once_with({
'type': 'delete',
'data': {'msg': 'test'},
'data': {'msg': 'test', '_id': '61cb302a8bf859b605514445'},
'ts': ts
}, dumps=ujson.dumps)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment