Skip to content

Commit

Permalink
tests: added sqs vertex verification
Browse files Browse the repository at this point in the history
  • Loading branch information
tsypuk committed Jul 27, 2023
1 parent 167db1a commit 03ecea8
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 3 deletions.
36 changes: 33 additions & 3 deletions tests/test_aws_vertecies.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ def test_dynamo(self):
self.verify_mxfile_default(et.ElementTree(tree))

mx_cells = tree.findall("./*/*/*/")
self.assertEqual(3, len(mx_cells))
self.verify_mx_cell(mx_cells[0], expected={'id': '0'})
self.verify_mx_cell(mx_cells[1], expected={'id': '1', 'parent': '0'})
self.verify_vertex_added_in_isolation(mx_cells)

expected = {
'id': 'vertex:dynamo:arn:aws:dynamodb:eu-west-1:123456789012:table/prod-dynamo-table',
Expand All @@ -38,3 +36,35 @@ def test_dynamo(self):
'vertex': '1'
}
self.verify_mx_cell(mx_cells[2], expected)

def test_sqs(self):
# given
mcd = MultiCloudDiagrams()

# when
sqs_arn = 'arn:aws:sqs:eu-west-1:123456789012:int-eu-live-events.fifo'
metadata = {
"DelaySeconds": 0,
"FifoQueue": "TRUE",
"ReceiveMessageWaitTimeSeconds": 0,
"SqsManagedSseEnabled": "false",
"VisibilityTimeout": 30
}
mcd.add_vertex(id=sqs_arn, node_name='events', arn=sqs_arn, node_type='sqs', metadata=metadata)

# then
tree = et.ElementTree(mcd.mxfile)
self.verify_mxfile_default(et.ElementTree(tree))

mx_cells = tree.findall("./*/*/*/")
self.verify_vertex_added_in_isolation(mx_cells)

expected = {
'id': 'vertex:sqs:arn:aws:sqs:eu-west-1:123456789012:int-eu-live-events.fifo',
'value': '<b>Name</b>: events<BR><b>ARN</b>: arn:aws:sqs:eu-west-1:123456789012:int-eu-live-events.fifo <BR>-----------<BR><b>DelaySeconds</b>: 0<BR><b>FifoQueue</b>: TRUE<BR><b>ReceiveMessageWaitTimeSeconds</b>: 0<BR><b>SqsManagedSseEnabled</b>: false<BR><b>VisibilityTimeout</b>: 30',
'style': 'verticalLabelPosition=bottom;html=1;verticalAlign=top;aspect=fixed;align=left;pointerEvents=1;shape=mxgraph.aws4.resourceIcon;resIcon=mxgraph.aws4.sqs;fillColor=#F58534;gradientColor=#FF4F8B;gradientDirection=north;fillColor=#BC1356;strokeColor=#ffffff;dashed=0;verticalLabelPosition=bottom',
'parent': '1',
'vertex': '1'
}
self.verify_mx_cell(mx_cells[2], expected)

5 changes: 5 additions & 0 deletions utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,8 @@ def verify_mxfile_default(self, tree):
self.verify_diagrams(tree.findall("./"))
self.verify_mx_graph_models(tree.findall("/*/"))
self.verify_roots(tree.findall("./*/*/"))

def verify_vertex_added_in_isolation(self, mx_cells):
self.assertEqual(3, len(mx_cells))
self.verify_mx_cell(mx_cells[0], expected={'id': '0'})
self.verify_mx_cell(mx_cells[1], expected={'id': '1', 'parent': '0'})

0 comments on commit 03ecea8

Please sign in to comment.