@@ -55,21 +55,33 @@ def test_import_lib_gets_site():
5555 pass
5656
5757
58- def test_collection_call ():
58+ def test_collection_call (tmp_path_factory ):
5959 """Tests that you can get content from the parser using `new_entry`"""
6060 test_collection = Collection ()
61- content = create_collection_entry (content = None , collection = test_collection , foo = "bar" )
62- post = frontmatter .loads (content )
61+ content_path1 = tmp_path_factory .getbasetemp ()
62+ filepath = content_path1 / "test.md"
63+ content = create_collection_entry (
64+ collection = test_collection , content = None , foo = "bar" , filepath = filepath , editor = None
65+ )
66+ assert content .strip () == f"New entry created at { filepath } ."
6367
68+ post = frontmatter .loads (filepath .read_text ())
69+ print (filepath .read_text ())
6470 assert post ["title" ] == "Untitled Entry"
6571 assert post ["foo" ] == "bar"
6672
6773
68- def test_collection_call_with_content ():
74+ def test_collection_call_with_content (tmp_path_factory ):
6975 """Tests that you can get content from the parser using `new_entry`"""
7076 test_collection = Collection ()
71- content = create_collection_entry (content = "This is a test" , collection = test_collection , foo = "bar" )
72- post = frontmatter .loads (content )
77+ content_path1 = tmp_path_factory .getbasetemp ()
78+ filepath = content_path1 / "test.md"
79+ create_collection_entry (
80+ content = "This is a test" , collection = test_collection , foo = "bar" , filepath = filepath , editor = None
81+ )
82+ print (filepath .read_text ())
83+
84+ post = frontmatter .loads (filepath .read_text ())
7385
7486 assert post ["title" ] == "Untitled Entry"
7587 assert post ["foo" ] == "bar"
@@ -148,16 +160,21 @@ def test_config_loading_invalid_file(tmp_path, monkeypatch, capsys):
148160 CliConfig ().load_config (str (config_file ))
149161
150162
151- def test_collection_entry_with_custom_attributes ():
163+ def test_collection_entry_with_custom_attributes (tmp_path_factory ):
152164 """Tests that custom attributes are passed through to collection entry"""
153165 test_collection = Collection ()
154- content = create_collection_entry (
166+ content_path1 = tmp_path_factory .getbasetemp ()
167+ filepath = content_path1 / "test.md"
168+
169+ create_collection_entry (
155170 content = "Test content" ,
156171 collection = test_collection ,
157172 author = "Test Author" ,
158173 tags = "test,example" ,
174+ filepath = filepath ,
175+ editor = None ,
159176 )
160- post = frontmatter .loads (content )
177+ post = frontmatter .loads (filepath . read_text () )
161178
162179 assert post ["author" ] == "Test Author"
163180 assert post ["tags" ] == "test,example"
0 commit comments