Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test /server-info endpoint in Dockerized environment #1020

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions dandi/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
import os.path as op
from pathlib import Path
import time
from typing import Iterable, List

Check notice

Code scanning / CodeQL

Unused import Note test

Import of 'List' is not used.

Copilot Autofix AI 24 days ago

To fix the problem, we need to remove the unused import statement for List from the typing module. This will clean up the code and remove the unnecessary dependency. The change should be made in the dandi/tests/test_utils.py file, specifically on line 9.

Suggested changeset 1
dandi/tests/test_utils.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/dandi/tests/test_utils.py b/dandi/tests/test_utils.py
--- a/dandi/tests/test_utils.py
+++ b/dandi/tests/test_utils.py
@@ -8,3 +8,3 @@
 import time
-from typing import Iterable, List
+from typing import Iterable
 from urllib.parse import urlparse, urlunparse
EOF
@@ -8,3 +8,3 @@
import time
from typing import Iterable, List
from typing import Iterable
from urllib.parse import urlparse, urlunparse
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
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
Expand Down Expand Up @@ -396,9 +398,10 @@
)


@mark.skipif_no_network
def test_server_info() -> None:
r = requests.get("https://dandiarchive.org/server-info")
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")

Check warning on line 404 in dandi/tests/test_utils.py

View check run for this annotation

Codecov / codecov/patch

dandi/tests/test_utils.py#L402-L404

Added lines #L402 - L404 were not covered by tests
r.raise_for_status()
data = r.json()
assert "version" in data
Expand Down
Loading