def test_generate_models(self):
    M = generate_models(self.database)
    self.assertTrue(('category' in M))
    self.assertTrue(('event' in M))

    def assertFields(m, expected):
        actual = [(f.name, f.field_type) for f in m._meta.sorted_fields]
        self.assertEqual(actual, expected)
    assertFields(M['category'], [('id', 'AUTO'), ('name', 'VARCHAR'), ('parent', 'INT')])
    assertFields(M['event'], [('id', 'AUTO'), ('key', 'TEXT'), ('timestamp', 'DATETIME'), ('metadata', 'TEXT')])
def test_generate_models(self):
    M = generate_models(self.database)
    self.assertTrue(('category' in M))
    self.assertTrue(('event' in M))

    def assertFields(m, expected):
        actual = [(f.name, f.field_type) for f in m._meta.sorted_fields]
        self.assertEqual(actual, expected)
    assertFields(M['category'], [('id', 'AUTO'), ('name', 'VARCHAR'), ('parent', 'INT')])
    assertFields(M['event'], [('id', 'AUTO'), ('key', 'TEXT'), ('timestamp', 'DATETIME'), ('metadata', 'TEXT')])