Skip to content

Commit

Permalink
adapted test
Browse files Browse the repository at this point in the history
  • Loading branch information
burnout87 committed Jan 4, 2024
1 parent c3e4722 commit 4d86e18
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def test_table_product(dispatcher_live_fixture, mock_backend):
def test_text_product(dispatcher_live_fixture, mock_backend):
server = dispatcher_live_fixture
logger.info("constructed server: %s", server)

with open('tests/responses/ascii_binary.json', 'r') as fd:
tab_resp_json = json.loads(fd.read())
ascii_rep = tab_resp_json['output']['text_output']
Expand Down Expand Up @@ -517,3 +517,34 @@ def test_return_progress(dispatcher_live_fixture, mock_backend, run_asynch):
test_output_html = fd.read()

assert jdata['products']['progress_product_list'][0]['value'] == test_output_html


@pytest.mark.parametrize("api", [True, False])
def test_return_progress(dispatcher_live_fixture, mock_backend, api):
server = dispatcher_live_fixture
logger.info("constructed server: %s", server)

params = {'instrument': 'example0',
'query_status': 'new',
'query_type': 'Real',
'product_type': 'lightcurve',
'run_asynch': True,
'return_progress': True}
if api:
params['api'] = True

c = requests.get(os.path.join(server, "run_analysis"),
params=params)
logger.info("content: %s", c.text)
jdata = c.json()
logger.info(json.dumps(jdata, indent=4, sort_keys=True))
logger.info(jdata)
assert c.status_code == 200
with open(os.path.join(os.path.dirname(__file__), 'responses', 'test_output.html'), 'r') as fd:
test_output_html = fd.read()
if api:
assert 'progress_product_list' in jdata['products']
assert jdata['products']['progress_product_list'][0]['value'] == test_output_html
else:
assert 'progress_product_html_output' in jdata['products']
assert jdata['products']['progress_product_html_output'][0] == test_output_html

0 comments on commit 4d86e18

Please sign in to comment.