def _get_contexts(self): res = {} contexts = context_dao.all() for row in contexts: context, contextnumbers, contexttype, contextinclude = row res.update(self._format_context_data(context, contextnumbers, contexttype, contextinclude)) return res
def _get_contexts(self): res = {} contexts = context_dao.all() for row in contexts: context, contextnumbers, contexttype, contextinclude = row res.update( self._format_context_data(context, contextnumbers, contexttype, contextinclude)) return res
def test_all(self): context_name1 = 'test_context1' self._insert_context(context_name1, contexttype_name='internal1') self._insert_contextnumbers(context_name1) context_name2 = 'test_context2' self._insert_context(context_name2, contexttype_name='internal2') self._insert_contextnumbers(context_name2) context_full_infos = context_dao.all() for row in context_full_infos: context, contextnumbers, contexttype, contextinclude = row assert(context.name in [context_name1, context_name2]) assert(contextnumbers.context in [context_name1, context_name2]) self.assertEqual(contextinclude, None) self.assertEqual(contexttype.name, context.contexttype)
def test_all_empty(self): result = context_dao.all() self.assertEqual([], result)