feat(sqlalchemy): reverted not needed api change

This commit is contained in:
Jonathan Rohde
2024-06-25 08:29:18 +02:00
parent 642c352c69
commit d4b6b7c4e8
4 changed files with 15 additions and 6 deletions

View File

@@ -42,9 +42,9 @@ class TestModels(AbstractPostgresTest):
assert len(response.json()) == 1
with mock_webui_user(id="2"):
response = self.fast_api_client.get(self.create_url("/my-model"))
response = self.fast_api_client.get(self.create_url(query_params={"id": "my-model"}))
assert response.status_code == 200
data = response.json()
data = response.json()[0]
assert data["id"] == "my-model"
assert data["name"] == "Hello World"

View File

@@ -23,14 +23,20 @@ def get_fast_api_client():
class AbstractIntegrationTest:
BASE_PATH = None
def create_url(self, path):
def create_url(self, path="", query_params=None):
if self.BASE_PATH is None:
raise Exception("BASE_PATH is not set")
parts = self.BASE_PATH.split("/")
parts = [part.strip() for part in parts if part.strip() != ""]
path_parts = path.split("/")
path_parts = [part.strip() for part in path_parts if part.strip() != ""]
return "/".join(parts + path_parts)
query_parts = ""
if query_params:
query_parts = "&".join(
[f"{key}={value}" for key, value in query_params.items()]
)
query_parts = f"?{query_parts}"
return "/".join(parts + path_parts) + query_parts
@classmethod
def setup_class(cls):