magowiz 45802ecbdd
Feature/optimizing download (#118)
* 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`
2022-02-09 00:54:56 +01:00

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"
)