Skip to content

Commit

Permalink
Allow http redirect in test_create_delete_repo
Browse files Browse the repository at this point in the history
  • Loading branch information
leifwar committed Sep 18, 2023
1 parent 18465fa commit 84af135
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion cimsparql/async_sparql_wrapper.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from http import HTTPStatus
from typing import Optional

import httpx
Expand Down Expand Up @@ -39,7 +40,7 @@ async def queryAndConvert(self) -> dict:
)

status = response.status_code
if status != 200:
if status != HTTPStatus.OK:
raise exceptions.get(status, Exception)(response.content)

return response.json()
3 changes: 2 additions & 1 deletion tests/test_graphdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os
import re
from base64 import b64encode
from http import HTTPStatus
from typing import Callable, List

import httpx
Expand Down Expand Up @@ -159,7 +160,7 @@ async def test_create_delete_repo():
# Check if it is possible to make contact
try:
resp = httpx.get("http://" + url)
if resp.status_code != 200 and not os.getenv("CI"):
if resp.status_code not in [HTTPStatus.OK, HTTPStatus.FOUND] and not os.getenv("CI"):
pytest.skip("Could not contact RDF4J server")
except Exception as exc:
if os.getenv("CI"):
Expand Down

0 comments on commit 84af135

Please sign in to comment.