mirror of
https://github.com/Tech-Workers-Coalition-Italia/mobilizon-reshare.git
synced 2025-01-30 17:14:53 +01:00
1efa191771
* Rename query modules. * storage: save_publication_report: Create publications. * Remove placeholder PublicationStatus.UNSAVED * Minor fixes.
42 lines
1.1 KiB
Python
42 lines
1.1 KiB
Python
from logging import DEBUG
|
|
|
|
import pytest
|
|
|
|
from mobilizon_reshare.main.recap import recap
|
|
from mobilizon_reshare.models.publication import PublicationStatus
|
|
|
|
spec = {
|
|
# We need three events since recap will print only
|
|
# future events, but the 0th event happens at today + 0.
|
|
"event": 3,
|
|
"publications": [
|
|
{"event_idx": 1, "publisher_idx": 0, "status": PublicationStatus.COMPLETED},
|
|
{"event_idx": 2, "publisher_idx": 0, "status": PublicationStatus.COMPLETED},
|
|
],
|
|
"publisher": ["zulip"],
|
|
}
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"publisher_class", [pytest.lazy_fixture("mock_publisher_invalid_class")]
|
|
)
|
|
@pytest.mark.asyncio
|
|
async def test_start_event_from_db(
|
|
caplog, mock_publisher_config, mock_now, message_collector, generate_models
|
|
):
|
|
await generate_models(spec)
|
|
|
|
with caplog.at_level(DEBUG):
|
|
# calling the recap command
|
|
report = await recap()
|
|
assert report.successful
|
|
|
|
assert "Found 2 events to recap" in caplog.text
|
|
|
|
recap_message = """Upcoming
|
|
|
|
event_1
|
|
|
|
event_2"""
|
|
assert message_collector == [recap_message]
|