diff --git a/data/logs_model/test/mock_elasticsearch.py b/data/logs_model/test/mock_elasticsearch.py index 714899fcb..42645af6c 100644 --- a/data/logs_model/test/mock_elasticsearch.py +++ b/data/logs_model/test/mock_elasticsearch.py @@ -56,8 +56,7 @@ INDEX_REQUEST_2019_01 = [ 233, "datetime": "2019-01-01T03:30:00", - "metadata_json": - "{\"\\ud83d\\ude02\": \"\\ud83d\\ude02\\ud83d\\udc4c\\ud83d\\udc4c\\ud83d\\udc4c\\ud83d\\udc4c\", \"key\": \"value\", \"time\": 1520479800}", + "metadata_json": json.loads("{\"\\ud83d\\ude02\": \"\\ud83d\\ude02\\ud83d\\udc4c\\ud83d\\udc4c\\ud83d\\udc4c\\ud83d\\udc4c\", \"key\": \"value\", \"time\": 1520479800}"), "performer_id": 1, "kind_id": @@ -77,8 +76,7 @@ INDEX_REQUEST_2017_03 = [ 233, "datetime": "2017-03-08T03:30:00", - "metadata_json": - "{\"\\ud83d\\ude02\": \"\\ud83d\\ude02\\ud83d\\udc4c\\ud83d\\udc4c\\ud83d\\udc4c\\ud83d\\udc4c\", \"key\": \"value\", \"time\": 1520479800}", + "metadata_json": json.loads("{\"\\ud83d\\ude02\": \"\\ud83d\\ude02\\ud83d\\udc4c\\ud83d\\udc4c\\ud83d\\udc4c\\ud83d\\udc4c\", \"key\": \"value\", \"time\": 1520479800}"), "performer_id": 1, "kind_id": diff --git a/data/logs_model/test/test_elasticsearch.py b/data/logs_model/test/test_elasticsearch.py index c442ca44e..f079e7a4c 100644 --- a/data/logs_model/test/test_elasticsearch.py +++ b/data/logs_model/test/test_elasticsearch.py @@ -143,7 +143,9 @@ def mock_elasticsearch(): @urlmatch(netloc=FAKE_ES_HOST_PATTERN, path=r'/logentry_[0-9\-]*/doc') def index(url, req): index = url.path.split('/')[1] - return mock.index(index, json.loads(req.body)) + body = json.loads(req.body) + body['metadata_json'] = json.loads(body['metadata_json']) + return mock.index(index, body) @urlmatch(netloc=FAKE_ES_HOST_PATTERN, path=r'/logentry_\*/doc/_count') def count(_, req):