'Tests that columns of an instance can be read as a dict.'

def test_model_read_as_dict(self):

    tm = TestModel.create(count=8, text='123456789', a_bool=True)
    column_dict = {'id': tm.id, 'count': tm.count, 'text': tm.text, 'a_bool': tm.a_bool}
    self.assertEqual(sorted(tm.keys()), sorted(column_dict.keys()))
    self.assertSetEqual(set(tm.values()), set(column_dict.values()))
    self.assertEqual(sorted(tm.items(), key=itemgetter(0)), sorted(column_dict.items(), key=itemgetter(0)))
    self.assertEqual(len(tm), len(column_dict))
    for column_id in column_dict.keys():
        self.assertEqual(tm[column_id], column_dict[column_id])
    tm['count'] = 6
    self.assertEqual(tm.count, 6)
