|
2 | 2 |
|
3 | 3 | from time import sleep |
4 | 4 | from datetime import datetime |
5 | | -from os import path, remove |
| 5 | +from os import path, remove, listdir, getcwd |
6 | 6 | from os.path import exists |
7 | 7 |
|
8 | 8 | from notes_app.defaults import Defaults |
@@ -116,6 +116,18 @@ def test_save_file_data_handle_error(self, get_app): |
116 | 116 | assert controller.model.file_size > 0 # exact file size differs between OS types |
117 | 117 | assert datetime.fromtimestamp(controller.model.last_updated_on) >= _epoch_before |
118 | 118 |
|
| 119 | + # assert the file gets correctly dumped to disk |
| 120 | + dump_files_to_evaluate = [] |
| 121 | + for file in listdir(getcwd()): |
| 122 | + if file.startswith("__dump__"): |
| 123 | + dump_files_to_evaluate.append(file) |
| 124 | + |
| 125 | + # assert only 1 dump file is written |
| 126 | + assert len(dump_files_to_evaluate) == 1 |
| 127 | + with open(file=dump_files_to_evaluate[0], mode="r") as f: |
| 128 | + assert f.readlines() == ['<section=first> Quod equidem non reprehendo\n', |
| 129 | + '<section=second> Quis istum dolorem timet <section=third> !\n'] |
| 130 | + |
119 | 131 | def test_get_screen(self, get_app): |
120 | 132 | controller = get_app.controller |
121 | 133 | assert isinstance(controller.get_screen(), NotesView) |
0 commit comments