From 98a1710aa84778a8d24dedd98f1857d5ff39ddd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Tue, 10 Dec 2024 13:34:04 -0800 Subject: [PATCH] TST: adding remote testing upload test, inherited from astroquery --- pyvo/dal/tests/test_tap.py | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/pyvo/dal/tests/test_tap.py b/pyvo/dal/tests/test_tap.py index 0c22dc84..3e075974 100644 --- a/pyvo/dal/tests/test_tap.py +++ b/pyvo/dal/tests/test_tap.py @@ -6,7 +6,7 @@ from contextlib import ExitStack import datetime import re -from io import BytesIO +from io import BytesIO, StringIO from urllib.parse import parse_qsl import tempfile @@ -802,3 +802,37 @@ def test_get_endpoint_candidates(): "http://astroweb.projects.phys.ucl.ac.uk:8000/capabilities" ] assert svc._get_endpoint_candidates("capabilities") == expected_urls + + +@pytest.mark.remote_data +@pytest.mark.parametrize('stream_type', [BytesIO, StringIO]) +def test_tap_upload_remote(stream_type): + tmp_table = (''' + + + + + external URI for the physical artifact + + + + + + + + +
2013.1.01365.S
+
+
''') + + if stream_type == BytesIO: + tmp_table = tmp_table.encode() + query = ('select top 3 proposal_id from ivoa.ObsCore oc join ' + 'TAP_UPLOAD.proj_codes pc on oc.proposal_id=pc.prop_id') + service = TAPService('https://almascience.nrao.edu/tap') + + res = service.search(query, uploads={'proj_codes': stream_type(tmp_table)}) + assert len(res) == 3 + for row in res: + assert row['proposal_id'] == '2013.1.01365.S'