mirror of
https://github.com/bellingcat/auto-archiver-api.git
synced 2026-06-12 13:38:33 +03:00
Format and lint web directory (#67)
This commit is contained in:
@@ -14,8 +14,8 @@ def test_update_sheet_last_url_archived_at(db_session):
|
||||
assert isinstance(test_sheet.last_url_archived_at, datetime)
|
||||
before = test_sheet.last_url_archived_at
|
||||
assert (
|
||||
worker_crud.update_sheet_last_url_archived_at(db_session, "sheet-123")
|
||||
is True
|
||||
worker_crud.update_sheet_last_url_archived_at(db_session, "sheet-123")
|
||||
is True
|
||||
)
|
||||
db_session.refresh(test_sheet)
|
||||
assert isinstance(test_sheet.last_url_archived_at, datetime)
|
||||
@@ -23,10 +23,10 @@ def test_update_sheet_last_url_archived_at(db_session):
|
||||
|
||||
# Test non-existent sheet
|
||||
assert (
|
||||
worker_crud.update_sheet_last_url_archived_at(
|
||||
db_session, "non-existent-sheet"
|
||||
)
|
||||
is False
|
||||
worker_crud.update_sheet_last_url_archived_at(
|
||||
db_session, "non-existent-sheet"
|
||||
)
|
||||
is False
|
||||
)
|
||||
|
||||
|
||||
@@ -42,14 +42,14 @@ def test_create_or_get_user(test_data, db_session):
|
||||
|
||||
# already exists
|
||||
assert (
|
||||
u1 := worker_crud.create_or_get_user(db_session, "rick@example.com")
|
||||
) is not None
|
||||
u1 := worker_crud.create_or_get_user(db_session, "rick@example.com")
|
||||
) is not None
|
||||
assert u1.email == "rick@example.com"
|
||||
|
||||
# new user
|
||||
assert (
|
||||
u2 := worker_crud.create_or_get_user(db_session, "beth@example.com")
|
||||
) is not None
|
||||
u2 := worker_crud.create_or_get_user(db_session, "beth@example.com")
|
||||
) is not None
|
||||
assert u2.email == "beth@example.com"
|
||||
|
||||
assert db_session.query(models.User).count() == 4
|
||||
@@ -64,8 +64,8 @@ def test_create_tag(db_session):
|
||||
assert create_tag.id == "tag-101"
|
||||
assert db_session.query(models.Tag).count() == 1
|
||||
assert (
|
||||
db_session.query(models.Tag).filter(models.Tag.id == "tag-101").first()
|
||||
== create_tag
|
||||
db_session.query(models.Tag).filter(models.Tag.id == "tag-101").first()
|
||||
== create_tag
|
||||
)
|
||||
|
||||
# same id does not add new db entry
|
||||
|
||||
@@ -712,7 +712,11 @@ async def test_find_by_store_until(async_db_session):
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_get_sheets_by_id_hash(async_db_session):
|
||||
author_emails = ["rick@example.com", "morty@example.com", "jerry@example.com"]
|
||||
author_emails = [
|
||||
"rick@example.com",
|
||||
"morty@example.com",
|
||||
"jerry@example.com",
|
||||
]
|
||||
|
||||
# Add test data
|
||||
sheets = [
|
||||
|
||||
@@ -7,6 +7,7 @@ import alembic.config
|
||||
import pytest
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from app.web.main import app_factory
|
||||
from app.web.utils.metrics import EXCEPTION_COUNTER
|
||||
|
||||
|
||||
@@ -59,7 +60,6 @@ def test_serve_local_archive_logic(get_settings):
|
||||
try:
|
||||
# modify the settings
|
||||
get_settings.SERVE_LOCAL_ARCHIVE = "/app/local_archive_test"
|
||||
from app.web.main import app_factory
|
||||
|
||||
app = app_factory(get_settings)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user