Mobilizon-Reshare-condividi.../tests/event/test_event.py

27 lines
698 B
Python
Raw Normal View History

2021-05-03 17:26:34 +02:00
import pytest
2021-05-04 11:48:54 +02:00
from jinja2 import Template
2021-05-03 17:26:34 +02:00
2021-05-04 11:48:54 +02:00
@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')}}"
)
2021-05-04 11:48:54 +02:00
)
def test_fill_template(event, simple_template):
2021-05-03 17:26:34 +02:00
assert (
2021-05-04 11:48:54 +02:00
event._fill_template(simple_template)
== "test event|description of the event|location|2021-01-01, 11:30|2021-01-01, 11:30"
2021-05-03 17:26:34 +02:00
)
2021-05-04 11:48:54 +02:00
def test_format(event, simple_template):
2021-05-03 17:26:34 +02:00
assert (
2021-05-04 11:48:54 +02:00
event.format(simple_template)
== "test event|description of the event|location|2021-01-01, 11:30|2021-01-01, 11:30"
2021-05-03 17:26:34 +02:00
)