Adding Download.is_new/etc. for code suggestions. Fixing async test warnings.

This commit is contained in:
Roland 2023-09-20 12:58:35 -06:00
parent 351351d90c
commit b817534c37
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
11 changed files with 48 additions and 67 deletions

View file

@ -224,7 +224,7 @@ def get_title_from_html(html: str, url: str = None) -> str:
try:
return soup.title.string
except Exception: # noqa
logger.info(f'Unable to extract title {url}')
logger.debug(f'Unable to extract title {url}')
@optional_session

View file

@ -169,7 +169,7 @@ def test_archive_refresh_deleted_archive(test_client, test_session, archive_dire
@pytest.mark.asyncio
async def test_fills_contents_with_refresh(test_client, test_session, archive_factory, singlefile_contents_factory):
async def test_fills_contents_with_refresh(test_session, archive_factory, singlefile_contents_factory):
"""Refreshing archives fills in any missing contents."""
archive1 = archive_factory('example.com', 'https://example.com/one')
archive2 = archive_factory('example.com', 'https://example.com/one')
@ -277,7 +277,7 @@ def test_get_domains(test_session, archive_factory):
assert [i['domain'] for i in get_domains()] == []
@pytest.mark.asycio
@pytest.mark.asyncio
async def test_new_archive(test_session, fake_now):
singlefile, readability, screenshot = make_fake_archive_result()
fake_now(datetime(2000, 1, 1))
@ -521,7 +521,7 @@ def test_refresh_archives(test_session, test_directory, test_client, make_files_
@pytest.mark.asyncio
async def test_refresh_archives_index(test_session, test_directory, test_client, make_files_structure):
async def test_refresh_archives_index(test_session, make_files_structure):
"""Archives are indexed using ArchiveIndexer and archive_modeler."""
# The start of a typical singlefile html file.
singlefile_contents = '''<!DOCTYPE html> <html lang="en"><!--

View file

@ -89,7 +89,7 @@ def test_channel_no_download_frequency(test_client, test_session, test_directory
@pytest.mark.asyncio
def test_channel_frequency_update(download_channel, test_client, test_session, test_download_manager):
async def test_channel_frequency_update(download_channel, test_async_client, test_session, test_download_manager):
"""
A Channel's Download record is updated when the Channel's frequency is updated.
"""
@ -102,7 +102,7 @@ def test_channel_frequency_update(download_channel, test_client, test_session, t
url=download_channel.url,
download_frequency=100,
)
request, response = test_client.put(f'/api/videos/channels/{download_channel.id}', json=data)
request, response = await test_async_client.put(f'/api/videos/channels/{download_channel.id}', json=data)
assert response.status_code == HTTPStatus.NO_CONTENT, response.json
download = download_channel.get_download()
@ -115,7 +115,7 @@ def test_channel_frequency_update(download_channel, test_client, test_session, t
@pytest.mark.asyncio
async def test_channel_download_crud(test_session, simple_channel, test_downloader_config):
"""Modifying a Channel modifies it's Download."""
"""Modifying a Channel modifies its Download."""
assert simple_channel.url
assert simple_channel.download_frequency is None

View file

@ -220,7 +220,6 @@ def test_channel_downloader_hidden(video_download_manager):
assert [i.__json__() for i in downloaders] == [(dict(name='video', pretty_name='Videos')), ]
@pytest.mark.asyncio
def test_bad_downloader(test_session, video_download_manager):
"""
Attempting to use an unknown downloader should raise an error.