# Copyright (c) 2000-2004 LOGILAB S.A. (Paris, FRANCE). # http://www.logilab.fr/ -- mailto:contact@logilab.fr # # This program is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later # version. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. """unit tests for module extensions.argoutils squeleton generated by py2tests.py on Dec 09 at 20:19:54 utility functions to generate argo uml files """ __revision__ = "$Id: unittest_argo.py,v 1.9 2005/06/14 09:54:11 syt Exp $" import unittest import os os.environ['USE_DOCTYPE'] = '1' from logilab.common.astng.inspector import Linker from pyreverse.visitors.xmi_uml import XMIUMLVisitor from pyreverse.extensions.diadefslib import DefaultDiadefGenerator from pyreverse.extensions.diagrams import set_counter from pyreverse.extensions.argoutils import * from utils import FileTC, build_file_case, get_project project = get_project('data', "Test module") linker = Linker(project, tag=1) linker.visit(project) set_counter(0) dd = DefaultDiadefGenerator(linker).visit(project) for diagram in dd: diagram.extract_relationships() visitor = XMIUMLVisitor() xmi_doc = visitor.visit(project, 1000) class ArgoWriterTC(FileTC): """Writer that outputs ArgoUML files""" generated_files = ('Test_module.argo', 'Test_module.xmi', 'classes_Test_module.pgml', 'packages_Test_module.pgml') def setUp(self): FileTC.setUp(self) writer = ArgoWriter() writer.write(project, xmi_doc, dd, visitor.UUID_format) build_file_case(ArgoWriterTC) class OpenPgmlTC(unittest.TestCase): def test_known_values_open_pgml_1(self): name = "le beau diagramme" uuid = "xyz0123" self.assertEqual(open_pgml(name, uuid), ''' ''' % (uuid, name)) class MakeArgoTC(unittest.TestCase): def test_known_values_make_argo(self): self.assertEqual(make_argo('Mon beau projet', ['truc.pgml', 'bidule.pgml', 'chouette.pgml']), ''' pyreverse 0.5.2 Generated by pyargo (http://www.logilab.org/projects/pyreverse) ''') class MakePackageTC(unittest.TestCase): def test_known_values_make_package_1(self): self.assertEqual(make_package(1, 'uuid0001').strip(), ''' ''') class MakeDependencyTC(unittest.TestCase): def test_known_values_make_dependency_1(self): self.assertEqual(make_dependency(2, 1, 0).strip(), ''' sourcePortFig="Fig1.0" destPortFig="Fig0.0" sourceFigNode="Fig1" destFigNode="Fig0" ''') class MakeClassTC(unittest.TestCase): def test_known_values_make_class_1(self): self.assertEqual(make_class(1, 'uuid0001').strip(), ''' ''') def test_known_values_make_class_2(self): self.assertEqual(make_class(1, 'uuid0001', 2).strip(), ''' enclosingFig="2" ''') class MakeInterfaceTC(unittest.TestCase): def test_known_values_make_interface_1(self): self.assertEqual(make_interface(1, 'uuid0001').strip(),''' ''') def test_known_values_make_interface_2(self): self.assertEqual(make_interface(1, 'uuid0001', 2).strip(),''' enclosingFig="2" ''') class MakeGeneralizationTC(unittest.TestCase): def test_known_values_make_generalization_1(self): self.assertEqual(make_generalization(2, 1, 0).strip(), ''' sourcePortFig="Fig1.0" destPortFig="Fig0.0" sourceFigNode="Fig1" destFigNode="Fig0" ''') class MakeRealizationTC(unittest.TestCase): def test_known_values_make_realization_1(self): self.assertEqual(make_realization(2, 1, 0).strip(), ''' sourcePortFig="Fig1.0" destPortFig="Fig0.0" sourceFigNode="Fig1" destFigNode="Fig0" ''') class MakeAssociationTC(unittest.TestCase): def test_known_values_make_association_1(self): self.assertEqual(make_association(2, 1, 0).strip(), ''' sourcePortFig="Fig1.0" destPortFig="Fig0.0" sourceFigNode="Fig1" destFigNode="Fig0" ''') if __name__ == '__main__': unittest.main()