mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
chore: enhance API test coverage reporting and update dependencies
This commit is contained in:
parent
7b220e8883
commit
fa3a3be151
9 changed files with 48 additions and 46 deletions
|
|
@ -11,7 +11,6 @@ from src.security.auth import (
|
|||
Token,
|
||||
TokenData,
|
||||
Settings,
|
||||
get_config,
|
||||
)
|
||||
from src.db.users import User, AnonymousUser, PublicUser
|
||||
from datetime import datetime, timedelta, timezone
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
import pytest
|
||||
from unittest.mock import Mock, patch, MagicMock
|
||||
from unittest.mock import Mock, patch
|
||||
from fastapi import HTTPException
|
||||
from sqlmodel import Session, select
|
||||
from sqlmodel import Session
|
||||
from src.security.features_utils.usage import (
|
||||
check_limits_with_usage,
|
||||
increase_feature_usage,
|
||||
decrease_feature_usage,
|
||||
FeatureSet,
|
||||
)
|
||||
from src.db.organization_config import OrganizationConfig
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import pytest
|
||||
from unittest.mock import Mock, AsyncMock, patch
|
||||
from fastapi import HTTPException, Request
|
||||
from sqlmodel import Session, select
|
||||
from sqlmodel import Session
|
||||
from src.security.rbac.rbac import (
|
||||
authorization_verify_if_element_is_public,
|
||||
authorization_verify_if_user_is_author,
|
||||
|
|
@ -14,7 +14,6 @@ from src.db.courses.courses import Course
|
|||
from src.db.collections import Collection
|
||||
from src.db.resource_authors import ResourceAuthor, ResourceAuthorshipEnum, ResourceAuthorshipStatusEnum
|
||||
from src.db.roles import Role
|
||||
from src.db.user_organizations import UserOrganization
|
||||
|
||||
|
||||
class TestRBAC:
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import pytest
|
||||
from unittest.mock import AsyncMock, patch
|
||||
from fastapi import HTTPException
|
||||
from src.security.rbac.utils import (
|
||||
check_element_type,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import pytest
|
||||
from src.security.security import (
|
||||
security_hash_password,
|
||||
security_verify_password,
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ of the security functionality including:
|
|||
- Authorization utilities
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from src.tests.security.test_security import TestSecurity
|
||||
from src.tests.security.test_auth import TestAuth
|
||||
from src.tests.security.test_rbac import TestRBAC
|
||||
|
|
@ -24,49 +23,14 @@ class TestSecurityComprehensive:
|
|||
def test_security_module_imports(self):
|
||||
"""Test that all security modules can be imported successfully"""
|
||||
# Test core security imports
|
||||
from src.security.security import (
|
||||
security_hash_password,
|
||||
security_verify_password,
|
||||
ACCESS_TOKEN_EXPIRE_MINUTES,
|
||||
SECRET_KEY,
|
||||
ALGORITHM,
|
||||
)
|
||||
|
||||
# Test auth imports
|
||||
from src.security.auth import (
|
||||
authenticate_user,
|
||||
create_access_token,
|
||||
get_current_user,
|
||||
non_public_endpoint,
|
||||
Token,
|
||||
TokenData,
|
||||
Settings,
|
||||
)
|
||||
|
||||
# Test RBAC imports
|
||||
from src.security.rbac.rbac import (
|
||||
authorization_verify_if_element_is_public,
|
||||
authorization_verify_if_user_is_author,
|
||||
authorization_verify_based_on_roles,
|
||||
authorization_verify_based_on_org_admin_status,
|
||||
authorization_verify_based_on_roles_and_authorship,
|
||||
authorization_verify_if_user_is_anon,
|
||||
)
|
||||
|
||||
# Test RBAC utils imports
|
||||
from src.security.rbac.utils import (
|
||||
check_element_type,
|
||||
get_singular_form_of_element,
|
||||
get_id_identifier_of_element,
|
||||
)
|
||||
|
||||
# Test features utils imports
|
||||
from src.security.features_utils.usage import (
|
||||
check_limits_with_usage,
|
||||
increase_feature_usage,
|
||||
decrease_feature_usage,
|
||||
FeatureSet,
|
||||
)
|
||||
|
||||
# Verify all imports succeeded
|
||||
assert True
|
||||
|
|
@ -83,7 +47,6 @@ class TestSecurityComprehensive:
|
|||
|
||||
def test_feature_set_definition(self):
|
||||
"""Test that FeatureSet includes all expected features"""
|
||||
from src.security.features_utils.usage import FeatureSet
|
||||
|
||||
expected_features = [
|
||||
"ai", "analytics", "api", "assignments", "collaboration",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue