Skip to content

Commit

Permalink
feat: adds test examples REFS #6\n\ni've started an effort to formali…
Browse files Browse the repository at this point in the history
…se the stack with the realisation of #70\n\nthis setsup configtest where the fastapi test client is created and it can\nget the root endpoint and validate that it returns a proper body, the effort\nwill be to maintain a set of tests for everything the base framework manages\n\nwe will need to ensure that eject #55 can rewrite the namespaces so other\nprojects are able to keep working on the tests centric to their applicaiton
  • Loading branch information
devraj committed Apr 25, 2023
1 parent 67042c2 commit cf960d4
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/labs/routers/auth/tasks.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
from sqlalchemy.ext.asyncio import AsyncSession
from taskiq import TaskiqDepends

from ...db import get_async_session
from ...broker import broker

@broker.task
Expand All @@ -9,7 +13,9 @@ async def send_reset_password_email() -> None:
pass

@broker.task
async def send_account_verification_email() -> None:
async def send_account_verification_email(
session: AsyncSession = TaskiqDepends(get_async_session)
) -> None:
import logging
logging.error("Kicking off send_account_verification_email")

Expand Down
1 change: 1 addition & 0 deletions src/labs/schema/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class OTPTriggerSMSRequest(AppBaseModel):
class OTPVerifyRequest(AppBaseModel):
""" OTP sent to the server to verify if it's valid """
otp: str
mobile_number: str

class OTPTriggerResponse(AppBaseModel):
""" OTP Verification result """
Expand Down
2 changes: 0 additions & 2 deletions src/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""
"""


Expand Down
10 changes: 10 additions & 0 deletions src/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"""
"""
import pytest

@pytest.fixture(scope="module")
def test_client():
from fastapi.testclient import TestClient
from labs.api import app
return TestClient(app)
11 changes: 11 additions & 0 deletions src/tests/test_auth.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from fastapi.testclient import TestClient
from fastapi.security import OAuth2PasswordRequestForm

from labs.schema.auth import Token

def test_signup():
assert 1 == 1


def test_login():
assert 1 == 1

0 comments on commit cf960d4

Please sign in to comment.