mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2026-04-06 07:47:53 +10:00
small fixes
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import importlib
|
||||
from io import StringIO
|
||||
from types import SimpleNamespace
|
||||
|
||||
from archivebox.config.django import setup_django
|
||||
|
||||
@@ -8,6 +7,7 @@ setup_django()
|
||||
|
||||
User = importlib.import_module('django.contrib.auth.models').User
|
||||
TestCase = importlib.import_module('django.test').TestCase
|
||||
RequestFactory = importlib.import_module('django.test').RequestFactory
|
||||
api_v1_cli = importlib.import_module('archivebox.api.v1_cli')
|
||||
ScheduleCommandSchema = api_v1_cli.ScheduleCommandSchema
|
||||
cli_schedule = api_v1_cli.cli_schedule
|
||||
@@ -23,11 +23,10 @@ class CLIScheduleAPITests(TestCase):
|
||||
)
|
||||
|
||||
def test_schedule_api_creates_schedule(self):
|
||||
request = SimpleNamespace(
|
||||
user=self.user,
|
||||
stdout=StringIO(),
|
||||
stderr=StringIO(),
|
||||
)
|
||||
request = RequestFactory().post('/api/v1/cli/schedule')
|
||||
request.user = self.user
|
||||
request.stdout = StringIO()
|
||||
request.stderr = StringIO()
|
||||
args = ScheduleCommandSchema(
|
||||
every='daily',
|
||||
import_path='https://example.com/feed.xml',
|
||||
|
||||
@@ -25,7 +25,7 @@ __package__ = 'archivebox.misc'
|
||||
import sys
|
||||
import json
|
||||
import select
|
||||
from typing import Iterator, Dict, Any, Optional, TextIO
|
||||
from typing import Iterable, Iterator, Dict, Any, Optional, TextIO
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ def read_file(path: Path) -> Iterator[Dict[str, Any]]:
|
||||
yield record
|
||||
|
||||
|
||||
def read_args_or_stdin(args: tuple, stream: Optional[TextIO] = None) -> Iterator[Dict[str, Any]]:
|
||||
def read_args_or_stdin(args: Iterable[str], stream: Optional[TextIO] = None) -> Iterator[Dict[str, Any]]:
|
||||
"""
|
||||
Read from CLI arguments if provided, otherwise from stdin.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user