Exemplo n.º 1
0
def test_update_case_was_moved_but_exists_in_db_non_identical(
        moved_case_raw_dict, moved_case_raw_dict_new, rf_courts):
    FirstParser.process_duplicates = process_duplicates
    c_new = FirstParser(
        stage=1,
        codex='koap',
        court=Court.objects.filter(title='Невский районный суд').first(
        )).save_from_raw(moved_case_raw_dict_new)
    moved_case_raw_dict['defenses'].append({
        'defendant': "Ипатов Н.К.",
        "codex_articles": '20.2 ч.5'
    })
    c_old = FirstParser(
        stage=1,
        codex='koap',
        court=Court.objects.filter(title='Невский районный суд').first(
        )).save_from_raw(moved_case_raw_dict)
    print('saved 2 cases')
    assert Case.objects.count() == 2
    c_old.update_case()
    print('updated')
    assert Case.objects.count() == 1
    assert c_old.defenses.count() == 2
    assert c_old.url != moved_case_raw_dict['url']
    assert c_old.url == moved_case_raw_dict_new['url']
Exemplo n.º 2
0
def test_update_case_was_moved(moved_case_raw_dict, rf_courts):
    c_old = FirstParser(
        stage=1,
        codex='koap',
        court=Court.objects.filter(title='Невский районный суд').first(
        )).save_from_raw(moved_case_raw_dict)
    c_old.update_case()
    assert Case.objects.count() == 1
    print(c_old.url, 'NEW_URL')
    assert c_old.url != moved_case_raw_dict['url']
Exemplo n.º 3
0
def test_update_case_was_moved_but_exists_in_db(moved_case_raw_dict,
                                                moved_case_raw_dict_new,
                                                rf_courts):
    FirstParser.process_duplicates = process_duplicates
    c_new = FirstParser(
        stage=1,
        codex='koap',
        court=Court.objects.filter(title='Невский районный суд').first(
        )).save_from_raw(moved_case_raw_dict_new)
    c_old = FirstParser(
        stage=1,
        codex='koap',
        court=Court.objects.filter(title='Невский районный суд').first(
        )).save_from_raw(moved_case_raw_dict)
    assert Case.objects.count() == 2
    c_old.update_case()
    assert Case.objects.count() == 1
    assert c_old.url != moved_case_raw_dict['url']
    assert c_old.url == moved_case_raw_dict_new['url']