def test_to_sql(self): doc = self.registry.Documentation() doc.auto_doc() format_ = Configuration.get('schema_format') dot = SQLSchema('test', format=format_) doc.toSQL(dot) dot.save()
def test_one_table_with_foreign_key_on_label(self): dot = SQLSchema('My table model') table = dot.add_label('My table') table.add_column('My column', 'Integer', primary_key=True) table2 = dot.add_table('A 2nd table') table2.add_foreign_key('My fk', table, nullable=False) dot.render()
def test_to_sql(self, rollback_registry): registry = rollback_registry doc = registry.Documentation() doc.auto_doc() format_ = Configuration.get('schema_format') dot = SQLSchema('test', format=format_) doc.toSQL(dot) dot.save()
def anyblok2doc(): """Return auto documentation for the registry """ anyblok_registry = anyblok.start('autodoc') if anyblok_registry: anyblok_registry.commit() doc = anyblok_registry.Documentation() doc.auto_doc() if Configuration.get('doc_format') == 'RST': with open(Configuration.get('doc_output'), 'w') as fp: doc.toRST(fp) elif Configuration.get('doc_format') == 'UML': format_ = Configuration.get('schema_format') name_ = Configuration.get('schema_output') dot = ModelSchema(name_, format=format_) doc.toUML(dot) dot.save() elif Configuration.get('doc_format') == 'SQL': format_ = Configuration.get('schema_format') name_ = Configuration.get('schema_output') dot = SQLSchema(name_, format=format_) doc.toSQL(dot) dot.save()
def test_get_table_with_label(self): dot = SQLSchema('My UML model') table = dot.add_label('My table') self.assertEqual(dot.get_table('My table'), table)
def test_one_table_with_column(self): dot = SQLSchema('My table model') table = dot.add_table('My table') table.add_column('My column', 'Integer', primary_key=True) dot.render()
def test_one_label(self): dot = SQLSchema('My table model') dot.add_table('My table') dot.render()
def test_get_table_with_label(self): dot = SQLSchema('My UML model') table = dot.add_label('My table') assert dot.get_table('My table') == table