def test_update(self, curs=None): obj = mapping.get(curs, self.T, cond=Eq('id', 1)) obj.name = 'mamba' obj.client_ids = [44, 23] mapping.update(curs, obj) new_obj = mapping.get(curs, self.T, cond=Eq('id', 1)) self.assertEqual(obj.name, new_obj.name) self.assertEqual(obj.client_ids, new_obj.client_ids)
def test_get(self, curs=None): obj = mapping.get(curs, self.T, cond=Eq('id', 1)) self.assertEqual(1, obj.id) self.assertEqual('0', obj.name) self.assertEqual([0, 1, 2], obj.client_ids) obj.client_ids = [1, 1, 1] mapping.update(curs, obj) objs = mapping.get_list(curs, self.T, cond=Any(1, 'client_ids'), order_by='id') self.assertEqual(2, len(objs)) self.assertEqual(1, objs[0].id) self.assertEqual(2, objs[1].id)