-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b2f5816
commit 624cc42
Showing
8 changed files
with
101 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from guillotina.commands import Command | ||
from guillotina.component import get_utility | ||
from guillotina.interfaces import ICatalogUtility | ||
|
||
import asyncio | ||
import logging | ||
|
||
|
||
logger = logging.getLogger("guillotina_elasticsearch") | ||
|
||
|
||
class UpdateMappingsCommand(Command): | ||
description = "Update Mappings Command" | ||
migrator = None | ||
reindexer = None | ||
|
||
def get_parser(self): | ||
parser = super(UpdateMappingsCommand, self).get_parser() | ||
return parser | ||
|
||
async def run(self, arguments, settings, app): | ||
search = get_utility(ICatalogUtility) | ||
await asyncio.sleep(1) | ||
await search.update_mappings() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from guillotina.component import query_utility | ||
from guillotina_audit.interfaces import IAuditUtility | ||
|
||
import asyncio | ||
import json | ||
import pytest | ||
|
||
|
||
pytestmark = pytest.mark.asyncio | ||
|
||
|
||
async def test_mappings(guillotina_es): | ||
response, status = await guillotina_es( | ||
"POST", "/db/guillotina/@addons", data=json.dumps({"id": "audit"}) | ||
) | ||
assert status == 200 | ||
await asyncio.sleep(2) | ||
audit_utility = query_utility(IAuditUtility) | ||
await audit_utility.update_mappings() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters