Skip to content

Commit

Permalink
move common module to see if that fixes imports
Browse files Browse the repository at this point in the history
  • Loading branch information
danted22 committed Feb 6, 2025
1 parent e4b4939 commit 1a707c8
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 10 deletions.
Empty file added controllers/common/__init__.py
Empty file.
File renamed without changes.
2 changes: 1 addition & 1 deletion controllers/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from auth import UserData, requires_auth
from config.config import sah_config

from .common import validator
from .common.common import validator
from models import Filter

filters_endpoints = Blueprint("filters", __name__)
Expand Down
2 changes: 1 addition & 1 deletion controllers/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from auth import AuthError, UserData, requires_auth
from config.config import sah_config

from .common import (
from .common.common import (
DATETIME_PATTERN,
get_current_filters,
get_thread_id_for_users,
Expand Down
2 changes: 1 addition & 1 deletion controllers/posts.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from auth import AuthError, UserData, requires_auth
from config.config import sah_config

from .common import (
from .common.common import (
DATETIME_PATTERN,
get_current_filters,
get_thread_id_for_users,
Expand Down
2 changes: 1 addition & 1 deletion controllers/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from auth import UserData, requires_auth
from config.config import sah_config

from .common import DATETIME_PATTERN, validator
from .common.common import DATETIME_PATTERN, validator
from models import Post, Report, User

reports_endpoints = Blueprint("reports", __name__)
Expand Down
2 changes: 1 addition & 1 deletion controllers/root.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from config.config import sah_config

from .common import validator
from .common.common import validator
from models import Post, User

root_endpoints = Blueprint("root", __name__)
Expand Down
2 changes: 1 addition & 1 deletion controllers/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from auth import AuthError, UserData, requires_auth
from config.config import sah_config

from .common import send_push_notification, validator
from .common.common import send_push_notification, validator
from models import (
BLOCKED_USER_ROLE_ID,
Notification,
Expand Down
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def get_scoped_session():
# Mock the session for all controllers
# TODO: Surely there's a better way to do this
controllers = listdir(path.join(path.dirname(__file__), "../controllers"))
non_controllers = ["__init__.py", "common.py", "__pycache__"]
non_controllers = ["__init__.py", "common", "__pycache__"]
for controller in controllers:
if controller in non_controllers:
continue
Expand All @@ -160,7 +160,7 @@ def get_scoped_session():

await db.session.begin_nested()
mocker.patch("pywebpush.webpush")
mocker.patch("controllers.common.webpush")
mocker.patch("controllers.common.common.webpush")

yield db

Expand Down
4 changes: 2 additions & 2 deletions tests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from pytest_mock import MockerFixture
from quart.typing import TestClientProtocol

from controllers.common import send_email_notification
from controllers.common.common import send_email_notification

from models.db import SendADatabase
from utils.push_notifications import RawPushData
Expand All @@ -39,7 +39,7 @@
async def test_send_email_notification(
app_client: TestClientProtocol, test_db: SendADatabase, mocker: MockerFixture
) -> None:
send_email_func = mocker.patch("controllers.common.send_email")
send_email_func = mocker.patch("controllers.common.common.send_email")

async with app_client.app.app_context():
await send_email_notification(
Expand Down

0 comments on commit 1a707c8

Please sign in to comment.