Skip to content

Commit

Permalink
Don't test controller classes
Browse files Browse the repository at this point in the history
  • Loading branch information
piercefreeman committed Dec 15, 2024
1 parent 98a12f9 commit e0195a3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@


# Test Models and Enums
class TestStatus(Enum):
class ExampleStatus(Enum):
ACTIVE = "active"
INACTIVE = "inactive"


class ExampleBaseModel(BaseModel):
name: str
status: TestStatus
status: ExampleStatus


class ExampleRequestModel(BaseModel):
Expand All @@ -54,22 +54,22 @@ class TestRenderModel(RenderBase):


# Test Controllers
class TestBaseController(ControllerBase):
class ExampleBaseController(ControllerBase):
@passthrough
def base_action(self) -> ExampleResponseModel: # type: ignore
"""Base action that returns a response model"""
pass


class ExampleController(TestBaseController):
class ExampleController(ExampleBaseController):
url = "/test"
view_path = "/test.tsx"

async def render( # type: ignore
self,
path_param: str,
query_param: int = 0,
enum_param: TestStatus = TestStatus.ACTIVE,
enum_param: ExampleStatus = ExampleStatus.ACTIVE,
) -> TestRenderModel: # type: ignore
"""Main render method"""
pass
Expand Down Expand Up @@ -233,7 +233,7 @@ def test_script_generation(self, generator: LocalModelGenerator) -> None:
assert "export type { TestRenderModel as TestRenderModel }" in content

# Check for enum exports
assert "export { TestStatus as TestStatus }" in content
assert "export { ExampleStatus as ExampleStatus }" in content


class TestLocalUseServerGenerator:
Expand Down
4 changes: 2 additions & 2 deletions mountaineer/__tests__/client_builder/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import pytest
from fastapi import File, Form, UploadFile
from pydantic import BaseModel, validator
from pydantic import BaseModel, field_validator, validator

from mountaineer.actions.fields import FunctionActionType
from mountaineer.actions.passthrough_dec import passthrough
Expand Down Expand Up @@ -39,7 +39,7 @@ class ExampleModelBase(BaseModel):
int_field: int
enum_field: TestEnum

@validator("string_field")
@field_validator("string_field")
def validate_string(cls, v):
if len(v) < 3:
raise ValueError("String too short")
Expand Down

0 comments on commit e0195a3

Please sign in to comment.