Skip to content

Commit

Permalink
tests: sync tests to latest models refactoring
Browse files Browse the repository at this point in the history
Signed-off-by: Ricardo Cañuelo <[email protected]>
  • Loading branch information
Ricardo Cañuelo committed Jan 5, 2024
1 parent fe0eb29 commit 93f1b42
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion tests/e2e_tests/test_user_creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import pytest

from e2e_tests.conftest import db_create

Check failure on line 11 in tests/e2e_tests/test_user_creation.py

View workflow job for this annotation

GitHub Actions / Lint

Unable to import 'e2e_tests.conftest'
from api.user_models import User
from api.models import User
from api.db import Database
from api.auth import Authentication

Expand Down
6 changes: 3 additions & 3 deletions tests/unit_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
get_current_user,
get_current_superuser,
)
from api.user_models import User
from api.pubsub import PubSub, Subscription
from api.models import User, Subscription
from api.pubsub import PubSub

BEARER_TOKEN = "Bearer \
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJib2IifQ.\
Expand Down Expand Up @@ -310,6 +310,6 @@ def mock_user_find(mocker):
Mocks async call to external method to find user model using Beanie
"""
async_mock = AsyncMock()
mocker.patch('api.user_models.User.find_one',
mocker.patch('api.models.User.find_one',
side_effect=async_mock)
return async_mock
4 changes: 2 additions & 2 deletions tests/unit_tests/test_node_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import json

from tests.unit_tests.conftest import BEARER_TOKEN
from api.models import Node, Revision
from api.paginator_models import PageModel
from kernelci.api.models import Node, Revision

Check failure on line 16 in tests/unit_tests/test_node_handler.py

View workflow job for this annotation

GitHub Actions / Lint

Unable to import 'kernelci.api.models'
from api.models import PageModel


def test_create_node_endpoint(mock_db_create, mock_publish_cloudevent,
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/test_token_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"""Unit test function for KernelCI API token handler"""

import pytest
from api.user_models import User
from api.models import User


@pytest.mark.asyncio
Expand Down
3 changes: 1 addition & 2 deletions tests/unit_tests/test_user_group_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
ADMIN_BEARER_TOKEN,
BEARER_TOKEN,
)
from api.models import UserGroup
from api.paginator_models import PageModel
from api.models import UserGroup, PageModel


def test_create_user_group(mock_db_create, mock_publish_cloudevent,
Expand Down
3 changes: 1 addition & 2 deletions tests/unit_tests/test_user_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
ADMIN_BEARER_TOKEN,
BEARER_TOKEN,
)
from api.models import UserGroup
from api.user_models import UserRead
from api.models import UserGroup, UserRead


@pytest.mark.asyncio
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/test_whoami_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import pytest
from tests.unit_tests.conftest import BEARER_TOKEN
from api.user_models import UserRead
from api.models import UserRead


@pytest.mark.asyncio
Expand Down

0 comments on commit 93f1b42

Please sign in to comment.