refactor shared setting to avoid circular dependency

This commit is contained in:
msramalho
2024-10-21 11:38:42 +01:00
parent 84cbf720a9
commit 9542a04646
6 changed files with 17 additions and 13 deletions

View File

@@ -57,7 +57,7 @@ def test_data(db_session):
def test_get_archive(test_data, db_session):
from db import crud
from web.security import ALLOW_ANY_EMAIL
from core.config import ALLOW_ANY_EMAIL
print(db_session.query(models.Group).all())
@@ -88,7 +88,7 @@ def test_get_archive(test_data, db_session):
def test_search_archives_by_url(test_data, db_session):
from db import crud
from web.security import ALLOW_ANY_EMAIL
from core.config import ALLOW_ANY_EMAIL
# rick's archives are private
assert len(crud.search_archives_by_url(db_session, "https://example-0.com", "rick@example.com")) == 34
@@ -133,7 +133,7 @@ def test_search_archives_by_url(test_data, db_session):
def test_search_archives_by_email(test_data, db_session):
from web.security import ALLOW_ANY_EMAIL
from core.config import ALLOW_ANY_EMAIL
from db import crud
# lower/upper case
@@ -157,7 +157,7 @@ def test_search_archives_by_email(test_data, db_session):
@patch("db.crud.DATABASE_QUERY_LIMIT", new=25)
def test_max_query_limit(test_data, db_session):
from db import crud
from web.security import ALLOW_ANY_EMAIL
from core.config import ALLOW_ANY_EMAIL
assert len(crud.search_archives_by_url(db_session, "https://example", ALLOW_ANY_EMAIL)) == 25
assert len(crud.search_archives_by_url(db_session, "https://example", ALLOW_ANY_EMAIL, limit=1000)) == 25
@@ -289,7 +289,7 @@ def test_create_tag(db_session):
def test_is_user_in_group(test_data, db_session):
from db import crud
from web.security import ALLOW_ANY_EMAIL
from core.config import ALLOW_ANY_EMAIL
# see user-groups.test.yaml
test_pairs = [