Skip to content

Commit

Permalink
debgu ci
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-oleshkevich committed Apr 16, 2024
1 parent b71c124 commit 89cdc5e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
4 changes: 3 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ repos:
rev: 'v1.9.0'
hooks:
- id: mypy
files: "ohmyadmin"
files: "ohmyadmin|tests"
additional_dependencies:
- types-python-slugify
- starlette
Expand All @@ -44,6 +44,8 @@ repos:
- types-beautifulsoup4
- types-passlib
- types-wtforms
- pytest
- polyfactory
- "sqlalchemy==2"

- repo: https://github.com/myint/docformatter.git
Expand Down
3 changes: 3 additions & 0 deletions ohmyadmin/contrib/sqla/datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ def __init__(
def filter(self, **filters: typing.Any) -> typing.Self:
return self

def order_by(self, *fields: str) -> typing.Self:
return self

def clone(self, query: sa.Select[tuple[T]]) -> typing.Self:
return self.__class__(
base_query=query,
Expand Down
4 changes: 2 additions & 2 deletions tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ def test_webmanifest(app_f: AppFactory) -> None:


def test_static_files(client: TestClient) -> None:
response = client.get("/admin/static/icons/icon.png")
response = client.get("/admin/static/.gitkeep")
assert response.status_code == 200
assert response.headers["content-type"] == "image/png"
assert response.headers["content-type"] == "text/plain; charset=utf-8"


async def test_media_files(auth_client: TestClient, file_storage: FileStorage) -> None:
Expand Down
4 changes: 2 additions & 2 deletions tests/test_datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from tests.models import User


type Filters = tuple[tuple[QueryFilter], dict[str, str | int]]
Filters = tuple[tuple[QueryFilter[User]], dict[str, str | int]]

root_user = User(
id=1,
Expand Down Expand Up @@ -814,7 +814,7 @@ async def test_one(self, http_request: Request) -> None:
assert await datasource.query(http_request).one() == user_user

async def test_one_none(self, http_request: Request) -> None:
datasource = MemorySource([])
datasource = MemorySource[User]([])
assert await datasource.query(http_request).one() is None

async def test_one_raises_for_many(self, http_request: Request) -> None:
Expand Down

0 comments on commit 89cdc5e

Please sign in to comment.