Skip to content

Commit

Permalink
Merge branch 'main' into rs/add-site-table
Browse files Browse the repository at this point in the history
  • Loading branch information
RonanMorgan authored Jul 12, 2024
2 parents 1877874 + 5199745 commit 6e37fc2
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 59 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ repos:
- id: debug-statements
language_version: python3
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.4.7'
rev: 'v0.5.1'
hooks:
- id: ruff
args:
Expand Down
63 changes: 32 additions & 31 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fastapi = ">=0.109.1,<1.0.0"
sqlmodel = "^0.0.16"
pydantic = ">=2.0.0,<3.0.0"
pydantic-settings = ">=2.0.0,<3.0.0"
requests = "^2.31.0"
requests = "^2.32.0"
PyJWT = "^2.8.0"
passlib = { version = "^1.7.4", extras = ["bcrypt"] }
uvicorn = ">=0.11.1,<1.0.0"
Expand All @@ -32,7 +32,7 @@ boto3 = "^1.26.0"
optional = true

[tool.poetry.group.quality.dependencies]
ruff = "==0.4.7"
ruff = "==0.5.1"
mypy = "==1.10.0"
types-requests = ">=2.0.0"
types-python-dateutil = "^2.8.0"
Expand Down Expand Up @@ -121,17 +121,17 @@ known-third-party = ["fastapi"]

[tool.ruff.lint.per-file-ignores]
"**/__init__.py" = ["I001", "F401", "CPY001"]
"scripts/**.py" = ["D", "T201", "S101", "ANN"]
"scripts/**.py" = ["D", "T201", "S101", "ANN", "RUF030"]
".github/**.py" = ["D", "T201", "ANN"]
"src/tests/**.py" = ["D103", "CPY001", "S101", "T201", "ANN001", "ANN201", "ANN202", "ARG001"]
"src/tests/**.py" = ["D103", "CPY001", "S101", "T201", "ANN001", "ANN201", "ANN202", "ARG001", "RUF030"]
"src/migrations/versions/**.py" = ["CPY001"]
"src/migrations/**.py" = ["ANN"]
"src/app/main.py" = ["ANN"]
"src/app/schemas/**.py" = ["A"]
"src/app/models.py" = ["A"]
"client/docs/**.py" = ["E402", "D103", "ANN", "A001", "ARG001"]
"client/setup.py" = ["T201"]
"client/tests/**.py" = ["D103", "CPY001", "S101", "T201", "ANN", "ARG001"]
"client/tests/**.py" = ["D103", "CPY001", "S101", "T201", "ANN", "ARG001", "RUF030"]

[tool.ruff.format]
quote-style = "double"
Expand Down
6 changes: 3 additions & 3 deletions src/app/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ async def init_db() -> None:
organization_id = organization.id

Check warning on line 47 in src/app/db.py

View check run for this annotation

Codecov / codecov/patch

src/app/db.py#L47

Added line #L47 was not covered by tests

# Check if admin exists
statement = select(User).where(User.login == settings.SUPERADMIN_LOGIN)
results = await session.execute(statement=statement)
user = results.scalar_one_or_none()
statement = select(User).where(User.login == settings.SUPERADMIN_LOGIN) # type: ignore[var-annotated]
results = await session.exec(statement=statement)
user = results.one_or_none()
if not user:
pwd = hash_password(settings.SUPERADMIN_PWD)
session.add(
Expand Down
2 changes: 1 addition & 1 deletion src/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def event_loop(request) -> Generator:

@pytest_asyncio.fixture(scope="function")
async def async_client() -> AsyncGenerator[AsyncClient, None]:
async with AsyncClient(
async with AsyncClient( # noqa: S113
app=app, base_url=f"http://api.localhost:8050{settings.API_V1_STR}", follow_redirects=True
) as client:
yield client
Expand Down
12 changes: 6 additions & 6 deletions src/tests/endpoints/test_cameras.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
),
],
)
@pytest.mark.asyncio()
@pytest.mark.asyncio
async def test_create_camera(
async_client: AsyncClient,
camera_session: AsyncSession,
Expand Down Expand Up @@ -106,7 +106,7 @@ async def test_create_camera(
(2, 1, 403, "Access forbidden.", 0),
],
)
@pytest.mark.asyncio()
@pytest.mark.asyncio
async def test_get_camera(
async_client: AsyncClient,
camera_session: AsyncSession,
Expand Down Expand Up @@ -141,7 +141,7 @@ async def test_get_camera(
(2, 200, None, pytest.camera_table[1]),
],
)
@pytest.mark.asyncio()
@pytest.mark.asyncio
async def test_fetch_cameras(
async_client: AsyncClient,
camera_session: AsyncSession,
Expand Down Expand Up @@ -180,7 +180,7 @@ async def test_fetch_cameras(
(2, 2, 403, "Incompatible token scope."),
],
)
@pytest.mark.asyncio()
@pytest.mark.asyncio
async def test_delete_camera(
async_client: AsyncClient,
camera_session: AsyncSession,
Expand Down Expand Up @@ -216,7 +216,7 @@ async def test_delete_camera(
(2, 1, 403, "Incompatible token scope."),
],
)
@pytest.mark.asyncio()
@pytest.mark.asyncio
async def test_create_camera_token(
async_client: AsyncClient,
camera_session: AsyncSession,
Expand Down Expand Up @@ -252,7 +252,7 @@ async def test_create_camera_token(
(1, 200, None),
],
)
@pytest.mark.asyncio()
@pytest.mark.asyncio
async def test_heartbeat(
async_client: AsyncClient,
camera_session: AsyncSession,
Expand Down
12 changes: 6 additions & 6 deletions src/tests/endpoints/test_detections.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
(None, 1, {"azimuth": 45.6}, 201, None),
],
)
@pytest.mark.asyncio()
@pytest.mark.asyncio
async def test_create_detection(
async_client: AsyncClient,
detection_session: AsyncSession,
Expand Down Expand Up @@ -73,7 +73,7 @@ async def test_create_detection(
(1, 2, 200, None, 1),
],
)
@pytest.mark.asyncio()
@pytest.mark.asyncio
async def test_get_detection(
async_client: AsyncClient,
detection_session: AsyncSession,
Expand Down Expand Up @@ -107,7 +107,7 @@ async def test_get_detection(
(1, 200, None, [pytest.detection_table[0], pytest.detection_table[1]]),
],
)
@pytest.mark.asyncio()
@pytest.mark.asyncio
async def test_fetch_detections(
async_client: AsyncClient,
detection_session: AsyncSession,
Expand Down Expand Up @@ -147,7 +147,7 @@ async def test_fetch_detections(
(2, 1, {"is_wildfire": True}, 403, None, 0),
],
)
@pytest.mark.asyncio()
@pytest.mark.asyncio
async def test_label_detection(
async_client: AsyncClient,
detection_session: AsyncSession,
Expand Down Expand Up @@ -187,7 +187,7 @@ async def test_label_detection(
(2, None, 403, "Access forbidden."),
],
)
@pytest.mark.asyncio()
@pytest.mark.asyncio
async def test_get_detection_url(
async_client: AsyncClient,
detection_session: AsyncSession,
Expand Down Expand Up @@ -234,7 +234,7 @@ async def test_get_detection_url(
(1, 2, 403, None),
],
)
@pytest.mark.asyncio()
@pytest.mark.asyncio
async def test_delete_detection(
async_client: AsyncClient,
detection_session: AsyncSession,
Expand Down
2 changes: 1 addition & 1 deletion src/tests/endpoints/test_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
({"username": "first_login", "password": "first_pwd"}, 200, None),
],
)
@pytest.mark.asyncio()
@pytest.mark.asyncio
async def test_login_with_creds(
async_client: AsyncClient,
user_session: AsyncSession,
Expand Down
10 changes: 5 additions & 5 deletions src/tests/endpoints/test_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
),
],
)
@pytest.mark.asyncio()
@pytest.mark.asyncio
async def test_create_user(
async_client: AsyncClient,
user_session: AsyncSession,
Expand Down Expand Up @@ -81,7 +81,7 @@ async def test_create_user(
(0, 2, 200, None, 1),
],
)
@pytest.mark.asyncio()
@pytest.mark.asyncio
async def test_get_user(
async_client: AsyncClient,
user_session: AsyncSession,
Expand Down Expand Up @@ -115,7 +115,7 @@ async def test_get_user(
(1, 403, "Incompatible token scope."),
],
)
@pytest.mark.asyncio()
@pytest.mark.asyncio
async def test_fetch_users(
async_client: AsyncClient,
user_session: AsyncSession,
Expand Down Expand Up @@ -149,7 +149,7 @@ async def test_fetch_users(
(1, 2, 403, "Incompatible token scope."),
],
)
@pytest.mark.asyncio()
@pytest.mark.asyncio
async def test_delete_user(
async_client: AsyncClient,
user_session: AsyncSession,
Expand Down Expand Up @@ -185,7 +185,7 @@ async def test_delete_user(
(1, 2, {"password": "HeyPyro!"}, 403, "Incompatible token scope.", None),
],
)
@pytest.mark.asyncio()
@pytest.mark.asyncio
async def test_update_user_password(
async_client: AsyncClient,
user_session: AsyncSession,
Expand Down

0 comments on commit 6e37fc2

Please sign in to comment.