Skip to content

Update of smartapi tests #254

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/config.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from copy import deepcopy

from biothings.web.auth.authn import DefaultCookieAuthnProvider
Expand Down Expand Up @@ -62,7 +63,7 @@
# In order to support ES_HOST configuration,
# Modify both model.py and utils.indices.py
ES_HOST = "http://localhost:9200"
SMARTAPI_ES_INDEX = "smartapi_docs"
SMARTAPI_ES_INDEX = os.getenv('SMARTAPI_ES_INDEX', 'smartapi_docs') #SMARTAPI_ES_INDEX = "smartapi_docs"
METAKG_ES_INDEX = "smartapi_metakg_docs"
METAKG_ES_INDEX_CONSOLIDATED = "smartapi_metakg_docs_consolidated"
ES_INDICES = {
Expand Down
7 changes: 6 additions & 1 deletion src/controller/smartapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,11 @@ def refresh(self, file=None):
self.webdoc.update(file)
return self.webdoc.status

def save(self, force_save=True):
def save(self, force_save=True, index=None, test_mode=False):
# TODO DOCSTRING

index = index or self.Index.name

if not self.raw:
raise ControllerError("No content.")

Expand Down Expand Up @@ -332,6 +334,9 @@ def save(self, force_save=True):
doc._meta.last_updated = self.last_updated
doc._meta.slug = self.slug
doc._meta.has_metakg = self.has_metakg

# save to the designated index
doc.meta.index = index
doc.save(skip_empty=False)

return self._id
Expand Down
Loading
Loading