mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-28 05:34:14 -04:00
feat: Add tests for remove command
This commit is contained in:
parent
a8ed72501d
commit
fe9604a772
4 changed files with 68 additions and 8 deletions
|
@ -9,7 +9,6 @@ from ..index.schema import Link
|
|||
from ..index import (
|
||||
load_link_details,
|
||||
write_link_details,
|
||||
write_main_index,
|
||||
)
|
||||
from ..util import enforce_types
|
||||
from ..logging_util import (
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
__package__ = 'archivebox.index'
|
||||
|
||||
import re
|
||||
import os
|
||||
import shutil
|
||||
import json as pyjson
|
||||
|
@ -373,7 +372,7 @@ LINK_FILTERS = {
|
|||
'exact': lambda pattern: Q(url=pattern),
|
||||
'substring': lambda pattern: Q(url__icontains=pattern),
|
||||
'regex': lambda pattern: Q(url__iregex=pattern),
|
||||
'domain': lambda pattern: Q(domain=pattern),
|
||||
'domain': lambda pattern: Q(url__istartswith=f"http://{pattern}") | Q(url__istartswith=f"https://{pattern}") | Q(url__istartswith=f"ftp://{pattern}"),
|
||||
}
|
||||
|
||||
@enforce_types
|
||||
|
|
|
@ -24,7 +24,6 @@ def parse_sql_main_index(out_dir: str=OUTPUT_DIR) -> Iterator[Link]:
|
|||
@enforce_types
|
||||
def remove_from_sql_main_index(snapshots: QuerySet, out_dir: str=OUTPUT_DIR) -> None:
|
||||
setup_django(out_dir, check_db=True)
|
||||
from core.models import Snapshot
|
||||
from django.db import transaction
|
||||
|
||||
with transaction.atomic():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue