Skip to content

Commit

Permalink
[OPT-1021] fix merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
smaneroiriusrisk committed Oct 18, 2023
1 parent ec97871 commit 1253c6f
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 13 deletions.
Empty file added sl_util/tests/util/__init__.py
Empty file.
File renamed without changes.
22 changes: 14 additions & 8 deletions slp_base/slp_base/provider_type.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
from otm.otm.entity.representation import RepresentationType
from otm.otm.provider import Provider

application_json = 'application/json'
text_plain = 'text/plain'
application_octet_stream = 'application/octet-stream'
application_xml = 'application/xml'


class IacType(str, Provider):
CLOUDFORMATION = ("CLOUDFORMATION", "CloudFormation", RepresentationType.CODE,
['application/json', 'text/yaml', 'text/plain', 'application/octet-stream'])
[application_json, 'text/yaml', text_plain, application_octet_stream])
TERRAFORM = ("TERRAFORM", "Terraform", RepresentationType.CODE,
['text/plain', 'application/octet-stream', 'application/json'])
[text_plain, application_octet_stream, application_json])
TFPLAN = ("TFPLAN", "Terraform Plan", RepresentationType.CODE,
['text/plain', 'application/json', 'application/msword', 'text/vnd.graphviz', 'application/octet-stream'])
[text_plain, application_json, 'application/msword', 'text/vnd.graphviz', application_octet_stream])


class DiagramType(str, Provider):
VISIO = ("VISIO", "Visio", RepresentationType.DIAGRAM,
['application/vnd.ms-visio.drawing.main+xml', 'application/octet-stream'])
['application/vnd.ms-visio.drawing.main+xml', application_octet_stream])
LUCID = ("LUCID", "Lucidchart", RepresentationType.DIAGRAM,
['application/vnd.ms-visio.drawing.main+xml', 'application/octet-stream', 'application/zip'])
# DRAWIO = ("DRAWIO", "Drawio", RepresentationType.DIAGRAM,
# ['application/octet-stream', 'application/xml', 'text/plain'])
['application/vnd.ms-visio.drawing.main+xml', application_octet_stream, 'application/zip'])
DRAWIO = ("DRAWIO", "Drawio", RepresentationType.DIAGRAM,
[application_octet_stream, application_xml, text_plain])


class EtmType(str, Provider):

MTMT = ("MTMT", "Microsoft Threat Modeling Tool", RepresentationType.THREAT_MODEL,
['application/octet-stream', 'application/xml', 'text/plain'])
[application_octet_stream, application_xml, text_plain])
2 changes: 1 addition & 1 deletion slp_drawio/tests/resources/test_resource_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
aws_minimal_xml = f'{drawio}/aws_minimal.drawio.xml'
aws_minimal_drawio = f'{drawio}/aws_minimal.drawio'
aws_minimal_drawio_as_json = f'{drawio}/aws_minimal_source.json'
wrong_mxcell_drawio = f'{drawio}/drawio/wrong_mxcell.drawio'
wrong_mxcell_drawio = f'{drawio}/wrong_mxcell.drawio'
wrong_mxfile_drawio = f'{drawio}/wrong_mxfile.drawio'
wrong_mxgraphmodel_drawio = f'{drawio}/wrong_mxgraphmodel.drawio'
wrong_root_drawio = f'{drawio}/wrong_root.drawio'
Expand Down
8 changes: 5 additions & 3 deletions slp_drawio/tests/validate/test_drawio_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
from starlette.datastructures import UploadFile, Headers

from sl_util.sl_util import secure_regex as re
from sl_util.tests.util.file_utils import get_upload_file

from slp_base import DiagramFileNotValidError, CommonError
from slp_drawio.slp_drawio.validate.drawio_validator import DrawioValidator
from slp_drawio.tests.resources.test_resource_paths import wrong_mxgraphmodel_drawio, wrong_mxfile_drawio, \
wrong_mxcell_drawio, wrong_root_drawio, aws_minimal_drawio, aws_minimal_drawio_xml, not_xml
from slp_visio.tests.util.files import get_upload_file
wrong_mxcell_drawio, wrong_root_drawio, aws_minimal_drawio, aws_minimal_xml, not_xml


filename_pattern = re.compile('^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}\\.[drawio|xml]')

Expand Down Expand Up @@ -71,7 +73,7 @@ def test_invalid_schema(self, filepath: str):

@pytest.mark.parametrize('mime, size, filepath', [
pytest.param('application/octet-stream', 10, aws_minimal_drawio, id='encoded-tiny-binary'),
pytest.param('application/xml', 10 * 1024 * 1024, aws_minimal_drawio_xml, id='xml-big-xml'),
pytest.param('application/xml', 10 * 1024 * 1024, aws_minimal_xml, id='xml-big-xml'),
pytest.param('text/plain', 10 * 1024 * 1024, aws_minimal_drawio, id='encoded-big-text')
])
def test_valid_file(self, mime: str, size: int, filepath: str):
Expand Down
2 changes: 1 addition & 1 deletion slp_visio/tests/integration/test_visio_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
expected_visio_aws_with_tz_and_vpc, expected_visio_orphan_dataflows, expected_visio_bidirectional_connectors, \
expected_visio_modified_single_connectors, visio_nested_tzs, expected_visio_nested_tzs, default_visio_mapping, \
visio_nested_tzs_inside_component, expected_visio_nested_tzs_inside_component
from slp_visio.tests.util.files import file_exists, get_upload_file
from sl_util.tests.util.file_utils import file_exists, get_upload_file


class TestVisioProcessor:
Expand Down

0 comments on commit 1253c6f

Please sign in to comment.