Skip to content

Commit 1e360b6

Browse files
Move tests into subfolders
1 parent 291c5fc commit 1e360b6

13 files changed

+14
-11
lines changed

tests/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"""
2+
This file marks tests as a Python package.
3+
"""

tests/conftest.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@
33
from sqlmodel import create_engine, Session, select
44
from sqlalchemy import Engine
55
from fastapi.testclient import TestClient
6-
import os
76
from dotenv import load_dotenv
8-
from utils.db import get_session, get_connection_url, tear_down_db, set_up_db
7+
from utils.db import get_connection_url, tear_down_db, set_up_db
98
from utils.models import User, PasswordResetToken, EmailUpdateToken, Organization, Role, Account
109
from utils.auth import get_password_hash, create_access_token, create_refresh_token
11-
from utils.dependencies import get_authenticated_user, get_user_with_relations
1210
from main import app
1311

1412
# Load environment variables

tests/routers/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"""
2+
This file marks tests.routers as a Python package.
3+
"""

tests/test_account.py renamed to tests/routers/test_account.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from urllib.parse import urlparse, parse_qs
99
from html import unescape
1010
from sqlalchemy import inspect
11-
from starlette.responses import RedirectResponse
1211

1312
from main import app
1413
from utils.models import User, PasswordResetToken, EmailUpdateToken, Account
@@ -18,7 +17,6 @@
1817
validate_token,
1918
get_password_hash
2019
)
21-
from .conftest import SetupError
2220

2321
# --- Fixture setup ---
2422

File renamed without changes.

tests/test_role.py renamed to tests/routers/test_role.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# test_role.py
22

33
import pytest
4-
from .conftest import SetupError
4+
from tests.conftest import SetupError
55
from utils.models import Role, Permission, ValidPermissions, User
66
from sqlmodel import Session, select
77

tests/test_user.py renamed to tests/routers/test_user.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from httpx import Response
33
from sqlmodel import Session
44
from unittest.mock import patch
5-
from typing import cast
65

76
from main import app
87
from utils.models import User

tests/utils/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"""
2+
This file marks tests.utils as a Python package.
3+
"""
File renamed without changes.

tests/test_db.py renamed to tests/utils/test_db.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import warnings
1+
22
from sqlmodel import Session, select, inspect
33
from sqlalchemy import Engine
44
from utils.db import (
@@ -10,8 +10,7 @@
1010
set_up_db,
1111
)
1212
from utils.models import Role, Permission, Organization, RolePermissionLink, ValidPermissions
13-
from .conftest import SetupError
14-
13+
from tests.conftest import SetupError
1514

1615
def test_get_connection_url():
1716
"""Test that get_connection_url returns a valid URL object"""

0 commit comments

Comments
 (0)