fix: Address high-severity bandit issues

This commit is contained in:
DSS
2025-12-11 07:13:06 -03:00
parent bcb4475744
commit 5b2a328dd1
167 changed files with 7051 additions and 7168 deletions

View File

@@ -1,13 +1,13 @@
"""Tests for the atomic DSS structure."""
import asyncio
from pathlib import Path
import json
from unittest.mock import patch, MagicMock
from unittest.mock import MagicMock, patch
import pytest
from httpx import Response
from dss.project.manager import ProjectManager, DSSProject, ProjectRegistry
from dss.models.component import AtomicType, Component
from dss.models.component import AtomicType
from dss.project.manager import DSSProject, ProjectManager, ProjectRegistry
@pytest.fixture
@@ -33,14 +33,15 @@ def dss_project(project_manager: ProjectManager, tmp_path: Path) -> DSSProject:
@patch("httpx.AsyncClient")
def test_recursive_figma_import(MockAsyncClient, dss_project: DSSProject, project_manager: ProjectManager):
def test_recursive_figma_import(
mock_async_client, dss_project: DSSProject, project_manager: ProjectManager
):
"""
Test that the Figma import is recursive and that the components are
classified correctly. This test mocks the FigmaTokenSource to
control the data returned during sync.
classified correctly.
"""
# Mock the httpx.AsyncClient to return a sample Figma file
mock_client_instance = MockAsyncClient.return_value
mock_client_instance = mock_async_client.return_value
mock_client_instance.get.return_value = Response(
200,
json={
@@ -63,17 +64,13 @@ def test_recursive_figma_import(MockAsyncClient, dss_project: DSSProject, projec
"id": "1:2",
"name": "Button",
"type": "COMPONENT",
"children": [
{"id": "1:1", "name": "Icon", "type": "COMPONENT"}
],
"children": [{"id": "1:1", "name": "Icon", "type": "COMPONENT"}],
},
{
"id": "1:3",
"name": "Card",
"type": "COMPONENT_SET",
"children": [
{"id": "1:2", "name": "Button", "type": "COMPONENT"}
],
"children": [{"id": "1:2", "name": "Button", "type": "COMPONENT"}],
},
],
}
@@ -96,5 +93,3 @@ def test_recursive_figma_import(MockAsyncClient, dss_project: DSSProject, projec
assert component.classification == AtomicType.ATOM
elif component.name == "Card":
assert component.classification == AtomicType.MOLECULE