From 41901c81416816825ff0348e1b281ff440c50c8d Mon Sep 17 00:00:00 2001 From: Michael Chin Date: Thu, 21 Jul 2022 18:46:24 -0700 Subject: [PATCH] Add tests for sparql_status without queryid --- .../iam/sparql/test_sparql_status_with_iam.py | 10 ++++++++++ .../notebook/test_sparql_graph_notebook.py | 13 +++++++++++++ 2 files changed, 23 insertions(+) diff --git a/test/integration/iam/sparql/test_sparql_status_with_iam.py b/test/integration/iam/sparql/test_sparql_status_with_iam.py index 04ddcf5d..846b799b 100644 --- a/test/integration/iam/sparql/test_sparql_status_with_iam.py +++ b/test/integration/iam/sparql/test_sparql_status_with_iam.py @@ -32,6 +32,16 @@ def test_do_sparql_status_nonexistent(self): assert status_res.status_code == 200 assert status_res.content == b'' + @pytest.mark.iam + @pytest.mark.neptune + def test_do_sparql_status_empty(self): + query_id = "" + status_response_fields = [b"acceptedQueryCount", b"runningQueryCount", b"queries"] + status_res = self.client.sparql_status(query_id) + assert status_res.status_code == 200 + for field in status_response_fields: + assert field in status_res.content + @pytest.mark.iam @pytest.mark.neptune def test_do_sparql_cancel_nonexistent(self): diff --git a/test/integration/without_iam/notebook/test_sparql_graph_notebook.py b/test/integration/without_iam/notebook/test_sparql_graph_notebook.py index 165f6e5a..15b110c4 100644 --- a/test/integration/without_iam/notebook/test_sparql_graph_notebook.py +++ b/test/integration/without_iam/notebook/test_sparql_graph_notebook.py @@ -70,6 +70,19 @@ def test_sparql_query_explain(self): self.assertTrue(sparql_res.startswith('')) self.assertTrue('' in sparql_res) + @pytest.mark.skip(reason="Line magics don't use user_ns; fix this when we figure out where store-to is being saved") + @pytest.mark.jupyter + @pytest.mark.sparql + @pytest.mark.neptune + def test_sparql_status(self): + store_to_var = 'sparql_status_res' + status_response_fields = ["acceptedQueryCount", "runningQueryCount", "queries"] + self.ip.run_line_magic('sparql_status', f'--store-to {store_to_var}') + self.assertFalse('graph_notebook_error' in self.ip.user_ns) + sparql_status_res = self.ip.user_ns[store_to_var] + for field in status_response_fields: + assert field in sparql_status_res + @pytest.mark.jupyter def test_load_sparql_config(self): config = '''{