@@ -126,6 +126,43 @@ def test_dfd(self):
126126 self .maxDiff = None
127127 self .assertEqual (output , expected )
128128
129+ def test_dfd_colormap (self ):
130+ dir_path = os .path .dirname (os .path .realpath (__file__ ))
131+ install_path = os .path .dirname (os .path .realpath (pytm .__file__ ))
132+
133+ with open (os .path .join (dir_path , "dfd_colormap.dot" )) as x :
134+ expected = (
135+ x .read ().strip ().replace ("INSTALL_PATH" , os .path .dirname (install_path ))
136+ )
137+
138+ random .seed (0 )
139+
140+ TM .reset ()
141+ tm = TM ("my test tm" , description = "aaa" )
142+ internet = Boundary ("Internet" )
143+ net = Boundary ("Company net" )
144+ dmz = Boundary ("dmz" , inBoundary = net )
145+ backend = Boundary ("backend" , inBoundary = net )
146+ user = Actor ("User" , inBoundary = internet )
147+ gw = Server ("Gateway" , inBoundary = dmz )
148+ web = Server ("Web Server" , inBoundary = backend )
149+ db = Datastore ("SQL Database" , inBoundary = backend , isEncryptedAtRest = True )
150+ comment = Data ("Comment" , isStored = True )
151+
152+ Dataflow (user , gw , "User enters comments (*)" )
153+ Dataflow (gw , web , "Request" )
154+ Dataflow (web , db , "Insert query with comments" , data = [comment ])
155+ Dataflow (db , web , "Retrieve comments" )
156+ Dataflow (web , gw , "Response" )
157+ Dataflow (gw , user , "Show comments (*)" )
158+
159+ self .assertTrue (tm .check ())
160+ tm .resolve ()
161+ output = tm .dfd (colormap = True )
162+
163+ self .maxDiff = None
164+ self .assertEqual (output , expected )
165+
129166 def test_dfd_duplicates_ignore (self ):
130167 dir_path = os .path .dirname (os .path .realpath (__file__ ))
131168 install_path = os .path .dirname (os .path .realpath (pytm .__file__ ))
0 commit comments