Skip to content

Commit

Permalink
test: Fix test for galileo-core
Browse files Browse the repository at this point in the history
  • Loading branch information
setu4993 committed Sep 3, 2024
1 parent 1494684 commit 63a2bac
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
from pathlib import Path
from typing import Callable, Generator, List, Optional
from unittest.mock import Mock, patch
from uuid import UUID
from uuid import UUID, uuid4

from pytest import FixtureRequest, MonkeyPatch, fixture

from galileo_core.constants.request_method import RequestMethod
from galileo_core.constants.routes import Routes as CoreRoutes
from galileo_core.schemas.core.user import User
from galileo_core.schemas.core.user_role import UserRole
from galileo_core.schemas.protect.response import Response, TraceMetadata
from galileo_core.schemas.protect.rule import Rule, RuleOperator
from galileo_core.schemas.protect.ruleset import Ruleset
Expand All @@ -24,7 +26,13 @@ def tmp_home_dir(monkeypatch: MonkeyPatch, tmp_path: Path) -> Generator[Path, No

@fixture
def mock_get_current_user(mock_request: Mock) -> Generator[None, None, None]:
matcher = mock_request(RequestMethod.GET, CoreRoutes.current_user, json={"email": "user@example.com"})
matcher = mock_request(
RequestMethod.GET,
CoreRoutes.current_user,
json=User.model_validate({"id": uuid4(), "email": "user@example.com", "role": UserRole.user}).model_dump(
mode="json"
),
)
yield
assert matcher.called

Expand Down

0 comments on commit 63a2bac

Please sign in to comment.