@@ -51,8 +51,8 @@ def test_default_filename(self, mock_log):
5151 )
5252
5353 @patch ("builtins.open" , new_callable = unittest .mock .mock_open ())
54- def test_write_standard_file_no_prefix (self , mock_open ):
55- """tests that standard file is named and written as expected with no prefix"""
54+ def test_write_standard_file_no_prefix_suffix (self , mock_open ):
55+ """tests that standard file is named and written as expected with no prefix or suffix """
5656 p = Procedures .construct ()
5757 default_filename = p .default_filename ()
5858 json_contents = p .json (indent = 3 )
@@ -77,6 +77,21 @@ def test_write_standard_file_with_prefix(self, mock_open):
7777 mock_open .assert_called_once_with (expected_file_path , "w" )
7878 mock_open .return_value .__enter__ ().write .assert_called_once_with (json_contents )
7979
80+ @patch ("builtins.open" , new_callable = unittest .mock .mock_open ())
81+ def test_write_standard_file_with_suffix (self , mock_open ):
82+ """tests that standard file is named and written as expected with filename suffix"""
83+ p = Procedures .construct ()
84+ json_contents = p .json (indent = 3 )
85+ suffix = ".aind.json"
86+ p .write_standard_file (suffix = suffix )
87+
88+ # It's expected that the file will be written to something like
89+ # procedure.aind.json
90+ expected_file_path = "procedures.aind.json"
91+
92+ mock_open .assert_called_once_with (expected_file_path , "w" )
93+ mock_open .return_value .__enter__ ().write .assert_called_once_with (json_contents )
94+
8095 @patch ("builtins.open" , new_callable = unittest .mock .mock_open ())
8196 def test_write_standard_file_with_output_directory (self , mock_open ):
8297 """tests that standard file is named and written as expected with designated output directory"""
0 commit comments