Skip to content

Commit

Permalink
Merge pull request #5 from crossk3/kcross-patch-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsvanspauwen committed Aug 4, 2023
2 parents 3b1226f + 542939d commit 40529ba
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 17 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ build/

# Credentials
gcs_credentials.json

.idea/
6 changes: 3 additions & 3 deletions pystructurizr/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


@click.command()
@click.option('--view', prompt='Your view file (e.g. example.componentview)',
@click.option('--view', prompt='Your view file (e.g. examples.single_file_example)',
help='The view file to generate.')
@click.option('--as-json', is_flag=True, default=False,
help='Dumps the generated code and the imported modules as a json object')
Expand All @@ -28,7 +28,7 @@ def dump(view, as_json):


@click.command()
@click.option('--view', prompt='Your view file (e.g. example.componentview)',
@click.option('--view', prompt='Your view file (e.g. examples.single_file_example)',
help='The view file to develop.')
def dev(view):
click.echo(f"Setting up live preview of view {view}...")
Expand All @@ -55,7 +55,7 @@ async def observe_loop():


@click.command()
@click.option('--view', prompt='Your view file (e.g. example.componentview)',
@click.option('--view', prompt='Your view file (e.g. examples.single_file_example)',
help='The view file to generate and upload to cloud storage.')
@click.option('--gcs-credentials', prompt='Path to json file containing Google Cloud Storage credentials', type=click.Path(exists=True),
help='Path to the credentials.json file for Google Cloud Storage.')
Expand Down
62 changes: 49 additions & 13 deletions test/example.gold
Original file line number Diff line number Diff line change
@@ -1,30 +1,40 @@
workspace {
model {
properties {
"structurizr.groupSeparator" "/"
}
customer = Person "Customer" "A user of our website." {
}
support_agent = Person "Support Agent" "Handles customer queries." {
}
chatsystem = SoftwareSystem "ChatSystem" "Provides a platform for customer support." {
chatwidget = Container "ChatWidget" "Embeddable chat widget for real-time customer support." {
technology "JavaScript"
}
chatserver = Container "ChatServer" "Handles message routing and storage." {
technology "Node.js"
messagerouter = Component "MessageRouter" "Routes messages between users." {
technology "Node.js"
data_analyst = Person "Data analyst" "Gathers insight about products and features and reports them to management." {
}
group "Our system" {
chatsystem = SoftwareSystem "ChatSystem" "Provides a platform for customer support." {
chatwidget = Container "ChatWidget" "Embeddable chat widget for real-time customer support." {
technology "JavaScript"
}
messagestore = Component "MessageStore" "Stores chat history." {
technology "MongoDB"
chatserver = Container "ChatServer" "Handles message routing and storage." {
technology "Node.js"
messagerouter = Component "MessageRouter" "Routes messages between users." {
technology "Node.js"
}
messagestore = Component "MessageStore" "Stores chat history." {
technology "MongoDB"
tags "database"
}
}
}
}
slack = SoftwareSystem "Slack" "Third party business chat application" {
group "External systems" {
slack = SoftwareSystem "Slack" "Third party business chat application" {
}
}
customer -> chatwidget "Initiates conversations" "chat widget"
support_agent -> slack "Responds to customer requests" "Slack"
chatwidget -> chatserver "Sends/receives messages" "xmpp"
chatserver -> slack "Integrates with" "None"
messagerouter -> messagestore "Stores messages" "None"
chatserver -> slack "Integrates with" ""
messagerouter -> messagestore "Stores messages" ""
}
views {
systemLandscape {
Expand All @@ -33,6 +43,32 @@ workspace {
autoLayout
}
styles {
element "Element" {
shape "RoundedBox"
}
element "Software System" {
background "#1168bd"
color "#ffffff"
}
element "Container" {
background "#438dd5"
color "#ffffff"
}
element "Component" {
background "#85bbf0"
color "#000000"
}
element "Person" {
background "#08427b"
color "#ffffff"
shape "Person"
}
element "Infrastructure Node" {
background "#ffffff"
}
element "database" {
shape "Cylinder"
}
element "Person" {
background "#08427b"
color "#ffffff"
Expand Down
2 changes: 1 addition & 1 deletion test/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def tearDown(self):
pass

def test_dump(self):
result = self.runner.invoke(cli.dump, ['--view', 'example.systemlandscapeview'])
result = self.runner.invoke(cli.dump, ['--view', 'examples.single_file_example'])

gold_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'example.gold')
with open(gold_file, "r", encoding='utf-8') as gfile:
Expand Down

0 comments on commit 40529ba

Please sign in to comment.