Skip to content

Commit

Permalink
Apply dumps changes
Browse files Browse the repository at this point in the history
  • Loading branch information
alallema committed Jun 15, 2022
1 parent 6bfee07 commit ce31c76
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 62 deletions.
23 changes: 0 additions & 23 deletions meilisearch/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,29 +383,6 @@ def create_dump(self) -> Dict[str, str]:
"""
return self.http.post(self.config.paths.dumps)

def get_dump_status(self, uid: str) -> Dict[str, str]:
"""Retrieve the status of a Meilisearch dump creation.
Parameters
----------
uid:
UID of the dump.
Returns
-------
Dump status:
Information about the dump status.
https://docs.meilisearch.com/reference/api/dump.html#get-dump-status
Raises
------
MeiliSearchApiError
An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://docs.meilisearch.com/errors/#meilisearch-errors
"""
return self.http.get(
self.config.paths.dumps + '/' + str(uid) + '/status'
)

def get_tasks(self) -> Dict[str, List[Dict[str, Any]]]:
"""Get all tasks.
Expand Down
29 changes: 6 additions & 23 deletions tests/client/test_client_dumps.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,12 @@
# pylint: disable=invalid-name

import pytest
from tests import wait_for_dump_creation
from meilisearch.errors import MeiliSearchApiError

def test_dump_creation(client, index_with_documents):
"""Tests the creation of a Meilisearch dump."""
index_with_documents("indexUID-dump-creation")
dump = client.create_dump()
assert dump['uid'] is not None
assert dump['status'] == 'in_progress'
wait_for_dump_creation(client, dump['uid'])

def test_dump_status_route(client, index_with_documents):
"""Tests the route for getting a Meilisearch dump status."""
index_with_documents("indexUID-dump-status")
dump = client.create_dump()
assert dump['uid'] is not None
assert dump['status'] == 'in_progress'
dump_status = client.get_dump_status(dump['uid'])
assert dump_status['uid'] is not None
assert dump_status['status'] is not None
wait_for_dump_creation(client, dump['uid'])

def test_dump_status_nonexistent_uid_raises_error(client):
"""Tests the route for getting an inexistent dump status."""
with pytest.raises(MeiliSearchApiError):
client.get_dump_status('uid_not_exists')
assert dump['taskUid'] is not None
assert dump['status'] == 'enqueued'
client.wait_for_task(dump['taskUid'])
dump_status = client.get_task(dump['taskUid'])
assert dump_status['status'] == 'succeeded'
assert dump_status['type'] == 'dumpCreation'
16 changes: 0 additions & 16 deletions tests/helper.py

This file was deleted.

0 comments on commit ce31c76

Please sign in to comment.