File tree 3 files changed +36
-3
lines changed
3 files changed +36
-3
lines changed Original file line number Diff line number Diff line change 1
1
# serializer version: 1
2
- # name: test_template_render [YAMLConfigFile]
2
+ # name: test_template_render_day_log [YAMLConfigFile]
3
3
'''
4
4
# 1991-03-04.Mon
5
5
#
Original file line number Diff line number Diff line change
1
+ # Template for saying hi to different people!
2
+
3
+ Hello {{ first_name }} {{ last_name }}
Original file line number Diff line number Diff line change 10
10
from . import common as c
11
11
12
12
13
- def test_template_render (
13
+ def test_template_render_day_log (
14
14
main : c .MainType ,
15
15
capsys : CaptureFixture ,
16
16
tmp_path : Path ,
17
17
snapshot : Snapshot ,
18
18
) -> None :
19
- """Test the 'template render' subcommand ."""
19
+ """Test that the 'day_log_tmpl.zo' template renders as expected ."""
20
20
zettel_dir = tmp_path / "org"
21
21
zot_basename = "day_log_tmpl.zo"
22
22
template_path : Path = zettel_dir / zot_basename
@@ -38,3 +38,33 @@ def test_template_render(
38
38
39
39
capture = capsys .readouterr ()
40
40
assert capture .out == snapshot
41
+
42
+
43
+ def test_template_render_hello (
44
+ main : c .MainType ,
45
+ capsys : CaptureFixture ,
46
+ tmp_path : Path ,
47
+ ) -> None :
48
+ """Test that the 'hello_tmpl.zo' template renders as expected."""
49
+ zettel_dir = tmp_path / "org"
50
+ zot_basename = "hello_tmpl.zo"
51
+ template_path : Path = zettel_dir / zot_basename
52
+ template_path .parent .mkdir (parents = True , exist_ok = True )
53
+ test_data_template_path = Path (__file__ ).parent / Path (
54
+ f"data/{ zot_basename } "
55
+ )
56
+ template_path .write_text (test_data_template_path .read_text ())
57
+
58
+ argv = [
59
+ "--dir" ,
60
+ str (zettel_dir ),
61
+ "template" ,
62
+ "render" ,
63
+ zot_basename ,
64
+ "first_name=John" ,
65
+ "last_name=Smith" ,
66
+ ]
67
+ assert main (* argv ) == 0
68
+
69
+ capture = capsys .readouterr ()
70
+ assert capture .out == "Hello John Smith\n "
You can’t perform that action at this time.
0 commit comments