Skip to content

Commit

Permalink
added response for test dataset if testMode is true
Browse files Browse the repository at this point in the history
  • Loading branch information
costero-e committed Nov 22, 2024
1 parent d9bc3fc commit eaabfcf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions beacon/request/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,17 @@ def from_request(self, request: Request) -> Self:
self.query.request_parameters[k] = html.escape(v)
elif k == 'filters':
self.query.request_parameters[k] = html.escape(v)
elif k == 'testMode':
v = html.escape(v)
if v.lower() == 'true':
v = True
elif v.lower() == 'false':
v = False
else:
err = 'testMode parameter can only be either true or false value'
errcode=400
raise_exception(err, errcode)
self.query.test_mode = v
elif k in ["start", "end", "assemblyId", "referenceName", "referenceBases", "alternateBases", "variantType","variantMinLength","variantMaxLength","geneId","genomicAlleleShortForm","aminoacidChange","clinicalRelevance", "mateName"]:
try:
if ',' in v:# pragma: no cover
Expand Down
2 changes: 1 addition & 1 deletion beacon/response/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ async def builder(self, request: Request, datasets, qparams, entry_type, entry_i
complete_module='beacon.connections.'+source+'.executor'
import importlib
module = importlib.import_module(complete_module, package=None)
testMode = qparams.query.testMode
testMode = qparams.query.test_mode
if testMode == True:
datasets = ['test']
datasets_docs, datasets_count, count, entity_schema, include, datasets = await module.execute_function(self, entry_type, datasets, qparams, entry_id)
Expand Down

0 comments on commit eaabfcf

Please sign in to comment.