Merge pull request #3361 from KeyboardNerd/fix_es_test

Fix elasticsearch test
This commit is contained in:
Sida Chen 2019-02-14 15:17:49 -05:00 committed by GitHub
commit ea9707b969
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

@ -56,8 +56,7 @@ INDEX_REQUEST_2019_01 = [
233, 233,
"datetime": "datetime":
"2019-01-01T03:30:00", "2019-01-01T03:30:00",
"metadata_json": "metadata_json": json.loads("{\"\\ud83d\\ude02\": \"\\ud83d\\ude02\\ud83d\\udc4c\\ud83d\\udc4c\\ud83d\\udc4c\\ud83d\\udc4c\", \"key\": \"value\", \"time\": 1520479800}"),
"{\"\\ud83d\\ude02\": \"\\ud83d\\ude02\\ud83d\\udc4c\\ud83d\\udc4c\\ud83d\\udc4c\\ud83d\\udc4c\", \"key\": \"value\", \"time\": 1520479800}",
"performer_id": "performer_id":
1, 1,
"kind_id": "kind_id":
@ -77,8 +76,7 @@ INDEX_REQUEST_2017_03 = [
233, 233,
"datetime": "datetime":
"2017-03-08T03:30:00", "2017-03-08T03:30:00",
"metadata_json": "metadata_json": json.loads("{\"\\ud83d\\ude02\": \"\\ud83d\\ude02\\ud83d\\udc4c\\ud83d\\udc4c\\ud83d\\udc4c\\ud83d\\udc4c\", \"key\": \"value\", \"time\": 1520479800}"),
"{\"\\ud83d\\ude02\": \"\\ud83d\\ude02\\ud83d\\udc4c\\ud83d\\udc4c\\ud83d\\udc4c\\ud83d\\udc4c\", \"key\": \"value\", \"time\": 1520479800}",
"performer_id": "performer_id":
1, 1,
"kind_id": "kind_id":

View file

@ -143,7 +143,9 @@ def mock_elasticsearch():
@urlmatch(netloc=FAKE_ES_HOST_PATTERN, path=r'/logentry_[0-9\-]*/doc') @urlmatch(netloc=FAKE_ES_HOST_PATTERN, path=r'/logentry_[0-9\-]*/doc')
def index(url, req): def index(url, req):
index = url.path.split('/')[1] 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') @urlmatch(netloc=FAKE_ES_HOST_PATTERN, path=r'/logentry_\*/doc/_count')
def count(_, req): def count(_, req):