def test_rf_parser_update(rf_courts, koap_articles, settings): settings.USE_TZ = True settings.TIME_ZONE = 'Europe/Moscow' assert settings.USE_TZ p = RFCasesGetter(codex='koap') p.get_cases(1) assert len(Case.objects.all()) revisions_len = len(Revision.objects.all()) assert revisions_len for case in Case.objects.all(): case.update_case()
def handle(self, *args, **options): courts = Court.objects.filter(region=77, site_type=2) codex = options['codex'] instance = options['instance'] courts_ids = courts.values_list('id', flat=True) RFCasesGetter(codex=codex).get_cases(instance, courts_ids=courts_ids)
def handle(self, *args, **options): courts = Court.objects.filter(instance=1) codex = options['codex'] instance = options['instance'] if options.get('region'): region = options['region'] courts = courts.filter(region=region) limit = options.get('limit') entry_date_from = options.get('entry_date_from') # DD.MM.YYYY articles = options.get('articles') # 19.3 ч.1, 20.2 ч.5, 20.2 ч.8 courts_ids = courts.values_list('id', flat=True) RFCasesGetter(codex=codex).get_cases(instance, courts_ids=courts_ids, courts_limit=limit, entry_date_from=entry_date_from, custom_articles=articles)
def handle(self, *args, **options): # Court.objects.all().delete() courts = Court.objects.filter(region=78) courts_ids = courts.values_list('id', flat=True) RFCasesGetter(codex='koap').get_cases(1, courts_ids=courts_ids, courts_limit=1)
def test_rf_parser_koap_first_instance(rf_courts, koap_articles): p = RFCasesGetter(codex='koap') p.get_cases(1) assert len(Case.objects.all())
def test_rf_parser_uk_second_instance(rf_courts, uk_articles): p = RFCasesGetter(codex='uk') p.get_cases(2) assert len(Case.objects.all())
def test_rf_parser_koap_second_instance(rf_courts, koap_articles): RFCasesGetter('koap').get_cases(2, rf_courts) assert len(Case.objects.all())
def search_for_new_url(self): from oi_sud.cases.parsers.rf import RFCasesGetter return RFCasesGetter(self.type).get_moved_case_url(self)