Dunitz/czi hosted test server (#2254)

update hosted unit tests to use wsgi server instead of cellxgene packages
This commit is contained in:
Madison Dunitz
2021-06-30 15:07:54 -07:00
committed by GitHub
parent 82de4178d9
commit 5007d307a2
17 changed files with 514 additions and 624 deletions
+2 -2
View File
@@ -168,7 +168,7 @@ def rest_get_data_adaptor(func):
return wrapped_function
def dataroot_test_index():
def dataroot_test_index():
# the following index page is meant for testing/debugging purposes
data = '<!doctype html><html lang="en">'
data += "<head><title>Hosted Cellxgene</title></head>"
@@ -475,6 +475,6 @@ class Server:
auth = server_config.auth
self.app.auth = auth
if auth.requires_client_login():
if auth and auth.requires_client_login():
auth.add_url_rules(self.app)
auth.complete_setup(self.app)
@@ -69,21 +69,21 @@ class AppConfig(object):
def update_server_config(self, **kw):
self.server_config.update(**kw)
self.is_complete = False
self.is_completed = False
def update_default_dataset_config(self, **kw):
self.default_dataset_config.update(**kw)
# update all the other dataset configs, if any
for value in self.dataroot_config.values():
value.update(**kw)
self.is_complete = False
self.is_completed = False
def update_single_config_from_path_and_value(self, path, value):
"""Update a single config parameter with the value.
Path is a list of string, that gives a path to the config parameter to be updated.
For example, path may be ["server","app","port"].
"""
self.is_complete = False
self.is_completed = False
if not isinstance(path, list):
raise ConfigurationError(f"path must be a list of strings, got '{str(path)}'")
for part in path:
@@ -147,7 +147,7 @@ class AppConfig(object):
if config.get("external"):
self.external_config.update_from_config(config["external"], "external")
self.is_complete = False
self.is_completed = False
def config_to_dict(self):
"""return the configuration as an unflattened dict"""
@@ -8,7 +8,7 @@ from server_timing import Timing as ServerTiming
from backend.czi_hosted.common.config.app_config import AppConfig
from backend.common.constants import Axis
from backend.common.errors import FilterError, JSONEncodingValueError, ExceedsLimitError, UnsupportedSummaryMethod
from backend.common.errors import FilterError, JSONEncodingValueError, ExceedsLimitError, UnsupportedSummaryMethod, DatasetAccessError
from backend.common.utils.utils import jsonify_numpy
from backend.common.fbs.matrix import encode_matrix_fbs
@@ -283,7 +283,7 @@ class DataAdaptor(metaclass=ABCMeta):
try:
obs_selector, var_selector = self._filter_to_mask(filter)
except (KeyError, IndexError, TypeError, AttributeError):
except (KeyError, IndexError, TypeError, AttributeError, DatasetAccessError):
raise FilterError("Error parsing filter")
if obs_selector is not None:
+4 -3
View File
@@ -29,12 +29,13 @@ server:
web_base_url: null
authentication:
# The authentication types may be "none", "session", "oauth"
# The authentication types may be "none", "session", "oauth" or "test"
# none: No authentication support, features like user_annotations must not be enabled.
# session: A session based userid is automatically generated. (no params needed)
# oauth: oauth2 is used for authentication; parameters are defined in params_oauth.
type: session
insecure_test_environment: false
# test: Simple module for testing the authentication logic without connecting to an external service
type: test
insecure_test_environment: true
params_oauth:
# url to the oauth server