@@ -0,0 +1,1845 @@
+# Copyright 2015 Isotoma Limited%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A#   http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless required by applicable law or agreed to in writing, software%0A# distributed under the License is distributed on an %22AS IS%22 BASIS,%0A# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A# See the License for the specific language governing permissions and%0A# limitations under the License.%0A%0Aimport mock%0A%0Afrom touchdown.tests.testcases import WorkspaceTestCase%0A%0A%0Aclass TestDotGraphGeneration(WorkspaceTestCase):%0A%0A    def test_generate_dot_graph(self):%0A        goal = self.create_goal('dot')%0A%0A        aws = self.workspace.add_aws()%0A        vpc = aws.add_vpc(name='test-vpc')%0A        subneta = vpc.add_subnet(name='subnet-a')%0A        subnetb = vpc.add_subnet(name='subnet-b')%0A%0A        echo = self.fixtures.enter_context(mock.patch.object(goal.ui, 'echo'))%0A        goal.execute()%0A%0A        # This should generate something like this:%0A%0A        # digraph ast %7B%0A        #    4432359760 %5Blabel=%22vpc 'test-vpc'%22%5D;%0A        #    4432359824 %5Blabel=%22subnet 'subnet-a'%22%5D;%0A        #    4432359824 -%3E 4432359760;%0A        #    4432359888 %5Blabel=%22subnet 'subnet-b'%22%5D;%0A        #    4432359888 -%3E 4432359760;%0A        # %7D%0A%0A        # As id() output isn't stable between test runs we have to settle for:%0A%0A        output = echo.call_args%5B0%5D%5B0%5D%0A        assert output.startswith('digraph ast %7B')%0A        assert ' %5Blabel=%22vpc %5C'test-vpc%5C'%22%5D;' in output%0A        assert ' %5Blabel=%22subnet %5C'subnet-a%5C'%22%5D;' in output%0A        assert ' %5Blabel=%22subnet %5C'subnet-b%5C'%22%5D;' in output%0A        assert output.count(' -%3E ') == 2%0A        assert output.count(';') == 5%0A        assert output.endswith('%7D')%0A

Test 'touchdown dot'