|
|
|
@ -5,7 +5,7 @@ import unittest
|
|
|
|
|
|
|
|
|
|
from diagrams import Diagram
|
|
|
|
|
from diagrams import setcluster, setdiagram
|
|
|
|
|
from diagrams.c4 import Person, Container, Database, System, SystemBoundary, Dependency
|
|
|
|
|
from diagrams.c4 import Person, Container, Database, System, SystemBoundary, Relationship
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class C4Test(unittest.TestCase):
|
|
|
|
@ -26,8 +26,6 @@ class C4Test(unittest.TestCase):
|
|
|
|
|
container = Container("container", "Java application", "The application.")
|
|
|
|
|
database = Database("database", "Oracle database", "Stores information.")
|
|
|
|
|
|
|
|
|
|
person >> container >> database
|
|
|
|
|
|
|
|
|
|
def test_external_nodes(self):
|
|
|
|
|
with Diagram(name=self.name, show=False):
|
|
|
|
|
external_person = Person("person", external=True)
|
|
|
|
@ -38,22 +36,27 @@ class C4Test(unittest.TestCase):
|
|
|
|
|
system = System("system", "The internal system.")
|
|
|
|
|
system_without_description = System("unknown")
|
|
|
|
|
|
|
|
|
|
system >> system_without_description >> external_system
|
|
|
|
|
|
|
|
|
|
def test_edges(self):
|
|
|
|
|
with Diagram(name=self.name, show=False):
|
|
|
|
|
c1 = Container("container1", "type", "description")
|
|
|
|
|
c2 = Container("container2", "type", "description")
|
|
|
|
|
c1 = Container("container1")
|
|
|
|
|
c2 = Container("container2")
|
|
|
|
|
|
|
|
|
|
c1 >> c2
|
|
|
|
|
|
|
|
|
|
def test_edges_with_labels(self):
|
|
|
|
|
with Diagram(name=self.name, show=False):
|
|
|
|
|
c1 = Container("container1")
|
|
|
|
|
c2 = Container("container2")
|
|
|
|
|
|
|
|
|
|
c1 >> Dependency("depends on") >> c2
|
|
|
|
|
c1 << Dependency("is dependend on") << c2
|
|
|
|
|
c1 >> Relationship("depends on") >> c2
|
|
|
|
|
c1 << Relationship("is depended on by") << c2
|
|
|
|
|
|
|
|
|
|
def test_edge_without_constraint(self):
|
|
|
|
|
with Diagram(name=self.name, show=False):
|
|
|
|
|
s1 = System("system 1")
|
|
|
|
|
s2 = System("system 2")
|
|
|
|
|
|
|
|
|
|
s1 >> Dependency(constraint="False") >> s2
|
|
|
|
|
s1 >> Relationship(constraint="False") >> s2
|
|
|
|
|
|
|
|
|
|
def test_cluster(self):
|
|
|
|
|
with Diagram(name=self.name, show=False):
|
|
|
|
|