def testCompare(self): results = compare_schemas.compare(self.schema_a, self.schema_b) results.report() self.failUnlessEqual(results.missing_tables, 1) self.failUnlessEqual(results.missing_fields, 1) self.failUnlessEqual(results.file2_missing_elements['tables'][0].table, 'C') self.failUnlessEqual(results.file2_missing_elements['fields'][0].field, 'missingField')
import compare_schemas from optparse import OptionParser if __name__ == '__main__': parser = OptionParser() parser.add_option('-d', '--db', dest="db", action="store", default="mysql") parser.add_option('-v', '--verbose', dest="verbose", action="store_true", default=False) (opts, args) = parser.parse_args() results = compare_schemas.compare(args[0], args[1], options=opts) print results
def testCompare(self): results = compare_schemas.compare(self.schema_a, self.schema_b) results.report() self.failUnlessEqual(results.missing_tables, 0, "There should be no missing tables") self.failUnlessEqual(results.missing_fields, 0, "There should be no missing fields: %s" % [result.__str__() for result in results.results])