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(
|
2022-02-09 00:54:56 +01:00
|
|
|
(
|
|
|
|
"{{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)
|
2022-02-09 00:54:56 +01:00
|
|
|
== "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)
|
2022-02-09 00:54:56 +01:00
|
|
|
== "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
|
|
|
)
|