From ca532e3cc022df90b0d73d68da1ac29b108d5b01 Mon Sep 17 00:00:00 2001 From: "John T. Wodder II" Date: Thu, 26 May 2022 14:30:59 -0400 Subject: [PATCH] Test /server-info endpoint in Dockerized environment --- dandi/tests/test_utils.py | 20 +++++++------------- tox.ini | 1 - 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/dandi/tests/test_utils.py b/dandi/tests/test_utils.py index 1f0c58fd9..02fc27032 100644 --- a/dandi/tests/test_utils.py +++ b/dandi/tests/test_utils.py @@ -1,16 +1,16 @@ import inspect -import os import os.path as op from pathlib import Path import time from typing import Iterable, List +from urllib.parse import urlparse, urlunparse import pytest import requests import responses from semantic_version import Version -from .skip import mark +from .fixtures import DandiAPI from .. import __version__ from ..consts import DandiInstance, known_instances from ..exceptions import BadCliVersionError, CliVersionTooOldError @@ -305,17 +305,11 @@ def test_get_instance_actual_dandi() -> None: assert inst.api is not None -if "DANDI_REDIRECTOR_BASE" in os.environ: - using_docker = pytest.mark.usefixtures("local_dandi_api") -else: - using_docker = mark.skipif_no_network - - -@pytest.mark.xfail(reason="https://github.com/dandi/dandi-archive/issues/1045") -@pytest.mark.redirector -@using_docker -def test_server_info() -> None: - r = requests.get(f"{redirector_base}/server-info") +# @pytest.mark.xfail(reason="https://github.com/dandi/dandi-archive/issues/1045") +def test_server_info(local_dandi_api: DandiAPI) -> None: + u = urlparse(local_dandi_api.api_url) + root_url = urlunparse(u[:2] + ("",) * 4) + r = requests.get(f"{root_url}/server-info") r.raise_for_status() data = r.json() assert "version" in data diff --git a/tox.ini b/tox.ini index 1cfe2ad53..bab922df4 100644 --- a/tox.ini +++ b/tox.ini @@ -43,7 +43,6 @@ commands = sphinx-build -E -W -b html source build addopts = --tb=short --durations=10 markers = integration - redirector filterwarnings = error ignore:No cached namespaces found .*:UserWarning