fix: accept nullable message publishers and scoped dev SPB trust
Some checks failed
Mostovik Backend CI/CD / Tests and lint (push) Successful in 3m3s
Mostovik Backend CI/CD / Deploy dev (push) Has been cancelled
Mostovik Backend CI/CD / Deploy and verify internal main (push) Has been cancelled
Mostovik Backend CI/CD / Build linux/amd64 release images (push) Has been cancelled
Some checks failed
Mostovik Backend CI/CD / Tests and lint (push) Successful in 3m3s
Mostovik Backend CI/CD / Deploy dev (push) Has been cancelled
Mostovik Backend CI/CD / Deploy and verify internal main (push) Has been cancelled
Mostovik Backend CI/CD / Build linux/amd64 release images (push) Has been cancelled
This commit is contained in:
@@ -105,7 +105,8 @@ def test_tls_trust_stays_default():
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_download_checksum_date_private_file_and_three_bounded_reads(tmp_path):
|
||||
@pytest.mark.parametrize("trusted", [False, True])
|
||||
def test_download_checksum_date_private_file_and_three_bounded_reads(tmp_path, trusted):
|
||||
import hashlib
|
||||
from contextlib import contextmanager
|
||||
from unittest.mock import patch
|
||||
@@ -117,6 +118,9 @@ def test_download_checksum_date_private_file_and_three_bounded_reads(tmp_path):
|
||||
|
||||
@contextmanager
|
||||
def response(session, url, **kwargs):
|
||||
from apps.parsers.clients.common.structured import EIS_CA_BUNDLE_PATH
|
||||
|
||||
assert session.verify == (str(EIS_CA_BUNDLE_PATH) if trusted else True)
|
||||
urls.append(url)
|
||||
|
||||
class Response:
|
||||
@@ -125,14 +129,16 @@ def test_download_checksum_date_private_file_and_three_bounded_reads(tmp_path):
|
||||
|
||||
yield Response()
|
||||
|
||||
with override_settings(PARSER_PRIVATE_ARTIFACT_ROOT=str(tmp_path)), patch.object(
|
||||
module, "registry_response", response
|
||||
):
|
||||
with override_settings(
|
||||
PARSER_PRIVATE_ARTIFACT_ROOT=str(tmp_path),
|
||||
EXCHANGE_SPB_RUSSIAN_TRUST_ENABLED=trusted,
|
||||
), patch.object(module, "registry_response", response):
|
||||
artifact = module.download_spb_artifact(load_batch=1)
|
||||
assert artifact.sha256 == hashlib.sha256(body).hexdigest()
|
||||
assert artifact.source_published_at.isoformat() == "2026-10-05"
|
||||
assert artifact.metadata["input_only"] is True
|
||||
assert len(urls) == 3
|
||||
assert module.registry_session().verify is True
|
||||
with pytest.raises(ValueError):
|
||||
_ = artifact.file.url
|
||||
|
||||
|
||||
Reference in New Issue
Block a user