def _collection_get_all(self, proxies, skip_exceptions): return [ Committee({"data": dict(COMMITTEE_SOURCE_DATA, committee_id=1)}), Committee({"data": dict(COMMITTEE_SOURCE_DATA, committee_id=2)}), Committee({"data": dict(COMMITTEE_SOURCE_DATA, committee_id=3)}), Committee({"data": dict(COMMITTEE_SOURCE_DATA, committee_id=4)}) ]
def test_active_committees(self): committees = Committee.get_all_active_committees() first_committee = committees.next() committee = Committee.get(first_committee.id) self.assertEqual(committee.name, first_committee.name) self.assertTrue(committee.portal_link != None and committee.portal_link != '' and committee.end_date == None)
def get_committee(id): qs = Committee.objects.filter(knesset_id=id) if qs.count() > 0: return qs.first() else: dataservice_committee = DataserviceCommittee.get(id) qs = Committee.objects.filter(name=dataservice_committee.name) if qs.count() > 0: qs.update(knesset_id=id) return qs.first() else: return Committee.objects.create( name=dataservice_committee.name, knesset_id=dataservice_committee.id, hide=True, knesset_type_id = dataservice_committee.type_id, knesset_parent_id = dataservice_committee.parent_id, name_eng = dataservice_committee.name_eng, name_arb = dataservice_committee.name_arb, start_date = dataservice_committee.begin_date, end_date = dataservice_committee.end_date, knesset_description = dataservice_committee.description, knesset_description_eng = dataservice_committee.description_eng, knesset_description_arb = dataservice_committee.description_arb, knesset_note = dataservice_committee.note, knesset_note_eng = dataservice_committee.note_eng, knesset_portal_link = dataservice_committee.portal_link, )
def _get_objects_by_active(self, void, proxies=None, **kwargs): self.logger.info('fetching active committees') self.descriptor["description"] = "active committees" return Committee.get_all_active_committees(has_portal_link=False, proxies=proxies)
def _update_active_committees(self): for ds_committee in DataserviceCommittee.get_all_active_committees(): committee = dict(self._translate_ds_to_model(ds_committee)) self._update_or_create(committee)
def _collection_get(self, object_id, proxies): if object_id == 4: return Committee( {"data": dict(COMMITTEE_SOURCE_DATA, committee_id=4)})
def _get_objects_by_active(self, void, proxies=None, **kwargs): return [ Committee({"data": dict(COMMITTEE_SOURCE_DATA, committee_id=3)}) ]
def test_committee(self): committee_id = 1 committee = Committee.get(committee_id) committees = Committee.get_page(order_by=('id', 'asc')) self.assertEqual(committee.name, committees[0].name)
def test_active_committees(self): committees = Committee.get_all_active_committees() committee = Committee.get(committees[0].id) self.assertEqual(committee.name, committees[0].name) self.assertTrue(committee.portal_link!=None and committee.portal_link != '' and committee.end_date==None)
def _update_active_committees(self): for ds_committee in DataserviceCommittee.get_all_active_committees( has_portal_link=False): committee = dict(self._translate_ds_to_model(ds_committee)) self._update_or_create(committee)
def test_committee(self): committee_id = 1 committee = Committee.get(committee_id) committees = Committee.get_page(order_by=('id', 'asc')) self.assertEqual(committee.name, committees.next().name)