From ff01bba4b698b85a30a8655e01ecacb2d71a8f1b Mon Sep 17 00:00:00 2001 From: Daniel Giles Date: Fri, 4 Oct 2024 09:19:38 -0700 Subject: [PATCH] added sia and register_mocks fixtures to test --- pyvo/dal/tests/test_datalink.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pyvo/dal/tests/test_datalink.py b/pyvo/dal/tests/test_datalink.py index 3650c4b2..6a13b610 100644 --- a/pyvo/dal/tests/test_datalink.py +++ b/pyvo/dal/tests/test_datalink.py @@ -4,6 +4,7 @@ Tests for pyvo.dal.datalink """ from functools import partial +import re import pytest @@ -30,6 +31,24 @@ def callback(request, context): ) as matcher: yield matcher +sia_re = re.compile('http://example.com/sia.*') + + +@pytest.fixture() +def register_mocks(mocker): + with mocker.register_uri( + 'GET', 'http://example.com/querydata/image.fits', + content=get_pkg_data_contents('data/querydata/image.fits') + ) as matcher: + yield matcher + + +@pytest.fixture() +def sia(mocker): + with mocker.register_uri( + 'GET', sia_re, content=get_pkg_data_contents('data/sia/dataset.xml') + ) as matcher: + yield matcher @pytest.fixture() def datalink(mocker):