mirror of
https://github.com/Tech-Workers-Coalition-Italia/mobilizon-reshare.git
synced 2025-01-30 00:55:13 +01:00
45802ecbdd
* add column last_update_time * save last_update_time in event db record * use id + updatedAt for comparison instead of mobilizon_id, this will treat updated events like new ones * rework event selection/comparison to include unpublished with updates to ones need to be saved * added update for unpublished events * tests: test_update: Add create_unpublished_events tests. * Move `MobilizonEvent.to_model` to `storage.query` * Move `MobilizonEvent.from_model` to `storage.query` * Move `MobilizonEvent.compute_status` to `storage.query` * Move `publishers.exception.EventNotFound` to `storage.query.exceptions`
27 lines
698 B
Python
27 lines
698 B
Python
import pytest
|
|
from jinja2 import Template
|
|
|
|
|
|
@pytest.fixture()
|
|
def simple_template():
|
|
return Template(
|
|
(
|
|
"{{name}}|{{description}}|{{location}}|{{begin_datetime.strftime('%Y-%m-%d, %H:%M')}}"
|
|
"|{{last_update_time.strftime('%Y-%m-%d, %H:%M')}}"
|
|
)
|
|
)
|
|
|
|
|
|
def test_fill_template(event, simple_template):
|
|
assert (
|
|
event._fill_template(simple_template)
|
|
== "test event|description of the event|location|2021-01-01, 11:30|2021-01-01, 11:30"
|
|
)
|
|
|
|
|
|
def test_format(event, simple_template):
|
|
assert (
|
|
event.format(simple_template)
|
|
== "test event|description of the event|location|2021-01-01, 11:30|2021-01-01, 11:30"
|
|
)
|